diff options
author | Martin Jambor <mjambor@suse.cz> | 2012-11-30 16:11:33 +0000 |
---|---|---|
committer | Martin Jambor <mjambor@suse.cz> | 2012-11-30 16:11:33 +0000 |
commit | df7be49a37c14849e5cf9b8e0470feefcd2a3d68 (patch) | |
tree | 84ce44d7b1f68a3a6a1630d3502026119cf95162 /gcc/ipa-prop.c | |
parent | 1a2e06ae1974307544d8c67f7543df501ef2ea25 (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/ipa-prop.c')
-rw-r--r-- | gcc/ipa-prop.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 6016257369f..01d142bface 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -2888,6 +2888,8 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt, { tree expr, base, off; location_t loc; + unsigned int deref_align; + bool deref_base = false; /* We create a new parameter out of the value of the old one, we can do the following kind of transformations: @@ -2921,9 +2923,15 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt, { HOST_WIDE_INT base_offset; tree prev_base; + bool addrof; if (TREE_CODE (base) == ADDR_EXPR) - base = TREE_OPERAND (base, 0); + { + base = TREE_OPERAND (base, 0); + addrof = true; + } + else + addrof = false; prev_base = base; base = get_addr_base_and_unit_offset (base, &base_offset); /* Aggregate arguments can have non-invariant addresses. */ @@ -2935,6 +2943,11 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt, } else if (TREE_CODE (base) == MEM_REF) { + if (!addrof) + { + deref_base = true; + deref_align = TYPE_ALIGN (TREE_TYPE (base)); + } off = build_int_cst (adj->alias_ptr_type, base_offset + adj->offset / BITS_PER_UNIT); @@ -2957,7 +2970,17 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt, unsigned int align; unsigned HOST_WIDE_INT misalign; - get_pointer_alignment_1 (base, &align, &misalign); + if (deref_base) + { + align = deref_align; + misalign = 0; + } + else + { + get_pointer_alignment_1 (base, &align, &misalign); + if (TYPE_ALIGN (type) > align) + align = TYPE_ALIGN (type); + } misalign += (tree_to_double_int (off) .sext (TYPE_PRECISION (TREE_TYPE (off))).low * BITS_PER_UNIT); |