aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2012-03-30 13:41:24 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2012-03-30 13:41:24 +0000
commitfef205d534494307974ac09ebf24af877fbb8e28 (patch)
treef83f4b1dda3054fd9af08275cd55b2ae04f88035 /gcc/tree-ssa-forwprop.c
parent0b7fccfaf20a0549e470b5be41c4fc4d0b657726 (diff)
downloadgcc-fef205d534494307974ac09ebf24af877fbb8e28.zip
gcc-fef205d534494307974ac09ebf24af877fbb8e28.tar.gz
gcc-fef205d534494307974ac09ebf24af877fbb8e28.tar.bz2
re PR other/52754 (indirect indexing broken with -fpredictive-commoning)
2012-03-30 Richard Guenther <rguenther@suse.de> PR tree-optimization/52754 * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Only propagate arbitrary addresses into really plain dereferences. * gcc.target/i386/pr52754.c: New testcase. From-SVN: r186012
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r--gcc/tree-ssa-forwprop.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 9197795..2b16222 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -905,6 +905,7 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
that of the pointed-to type of the address we can put the
dereferenced address on the LHS preserving the original alias-type. */
else if (gimple_assign_lhs (use_stmt) == lhs
+ && integer_zerop (TREE_OPERAND (lhs, 1))
&& useless_type_conversion_p
(TREE_TYPE (TREE_OPERAND (def_rhs, 0)),
TREE_TYPE (gimple_assign_rhs1 (use_stmt))))
@@ -917,9 +918,8 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
if (TREE_CODE (*def_rhs_basep) == MEM_REF)
{
new_base = TREE_OPERAND (*def_rhs_basep, 0);
- new_offset
- = int_const_binop (PLUS_EXPR, TREE_OPERAND (lhs, 1),
- TREE_OPERAND (*def_rhs_basep, 1));
+ new_offset = fold_convert (TREE_TYPE (TREE_OPERAND (lhs, 1)),
+ TREE_OPERAND (*def_rhs_basep, 1));
}
else
{
@@ -989,6 +989,7 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
that of the pointed-to type of the address we can put the
dereferenced address on the RHS preserving the original alias-type. */
else if (gimple_assign_rhs1 (use_stmt) == rhs
+ && integer_zerop (TREE_OPERAND (rhs, 1))
&& useless_type_conversion_p
(TREE_TYPE (gimple_assign_lhs (use_stmt)),
TREE_TYPE (TREE_OPERAND (def_rhs, 0))))
@@ -1001,9 +1002,8 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
if (TREE_CODE (*def_rhs_basep) == MEM_REF)
{
new_base = TREE_OPERAND (*def_rhs_basep, 0);
- new_offset
- = int_const_binop (PLUS_EXPR, TREE_OPERAND (rhs, 1),
- TREE_OPERAND (*def_rhs_basep, 1));
+ new_offset = fold_convert (TREE_TYPE (TREE_OPERAND (rhs, 1)),
+ TREE_OPERAND (*def_rhs_basep, 1));
}
else
{