aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-sra.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2012-11-30 16:11:33 +0000
committerMartin Jambor <mjambor@suse.cz>2012-11-30 16:11:33 +0000
commitdf7be49a37c14849e5cf9b8e0470feefcd2a3d68 (patch)
tree84ce44d7b1f68a3a6a1630d3502026119cf95162 /gcc/tree-sra.c
parent1a2e06ae1974307544d8c67f7543df501ef2ea25 (diff)
2012-11-30 Martin Jambor <mjambor@suse.cz>
PR middle-end/52890 PR tree-optimization/55415 PR tree-optimization/54386 PR target/55448 * ipa-prop.c (ipa_modify_call_arguments): Be optimistic when get_pointer_alignment_1 returns false and the base was not a dereference. * tree-sra.c (access_precludes_ipa_sra_p): New parameter req_align, added check for required alignment. Update the user. * testsuite/gcc.dg/ipa/ipa-sra-7.c: New test. * testsuite/gcc.dg/ipa/ipa-sra-8.c: Likewise. * testsuite/gcc.dg/ipa/ipa-sra-9.c: Likewise. * testsuite/gcc.target/i386/pr55448.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@193998 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r--gcc/tree-sra.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index b5606482629..4580ad22e64 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -3891,12 +3891,13 @@ unmodified_by_ref_scalar_representative (tree parm)
return repr;
}
-/* Return true iff this access precludes IPA-SRA of the parameter it is
- associated with. */
+/* Return true iff this ACCESS precludes IPA-SRA of the parameter it is
+ associated with. REQ_ALIGN is the minimum required alignment. */
static bool
-access_precludes_ipa_sra_p (struct access *access)
+access_precludes_ipa_sra_p (struct access *access, unsigned int req_align)
{
+ unsigned int exp_align;
/* Avoid issues such as the second simple testcase in PR 42025. The problem
is incompatible assign in a call statement (and possibly even in asm
statements). This can be relaxed by using a new temporary but only for
@@ -3908,6 +3909,10 @@ access_precludes_ipa_sra_p (struct access *access)
|| gimple_code (access->stmt) == GIMPLE_ASM))
return true;
+ exp_align = get_object_alignment (access->expr);
+ if (exp_align < req_align)
+ return true;
+
return false;
}
@@ -3943,7 +3948,7 @@ splice_param_accesses (tree parm, bool *ro_grp)
tree a1_alias_type;
access = (*access_vec)[i];
modification = access->write;
- if (access_precludes_ipa_sra_p (access))
+ if (access_precludes_ipa_sra_p (access, TYPE_ALIGN (access->type)))
return NULL;
a1_alias_type = reference_alias_ptr_type (access->expr);
@@ -3966,7 +3971,7 @@ splice_param_accesses (tree parm, bool *ro_grp)
else if (ac2->size != access->size)
return NULL;
- if (access_precludes_ipa_sra_p (ac2)
+ if (access_precludes_ipa_sra_p (ac2, TYPE_ALIGN (access->type))
|| (ac2->type != access->type
&& (TREE_ADDRESSABLE (ac2->type)
|| TREE_ADDRESSABLE (access->type)))