diff options
author | Martin Jambor <mjambor@suse.cz> | 2012-11-30 17:11:33 +0100 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2012-11-30 17:11:33 +0100 |
commit | c1ed6a0172fa629c31f23f99d76b3fa0109bb66b (patch) | |
tree | 84ce44d7b1f68a3a6a1630d3502026119cf95162 /gcc/ipa-prop.c | |
parent | d7b30db8d85f828c2a2c146142c6b07e7b69ba18 (diff) | |
download | gcc-c1ed6a0172fa629c31f23f99d76b3fa0109bb66b.zip gcc-c1ed6a0172fa629c31f23f99d76b3fa0109bb66b.tar.gz gcc-c1ed6a0172fa629c31f23f99d76b3fa0109bb66b.tar.bz2 |
re PR middle-end/52890 (Revision 185336 causes 10% degradation on cpu2000 benchmark 252.eon)
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.
From-SVN: r193998
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 6016257..01d142b 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); |