aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2011-09-07 11:28:39 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2011-09-07 11:28:39 +0000
commit601f64e2e91c232210796cce3bc12a2e19a36ff2 (patch)
treec6bedca9793378da04071c4b6c255b9f6de8eec4 /gcc/tree-ssa-forwprop.c
parent1aeee5ad50a46b9104eb9430054ff1d76dd5fe42 (diff)
downloadgcc-601f64e2e91c232210796cce3bc12a2e19a36ff2.zip
gcc-601f64e2e91c232210796cce3bc12a2e19a36ff2.tar.gz
gcc-601f64e2e91c232210796cce3bc12a2e19a36ff2.tar.bz2
re PR tree-optimization/50213 (Regression in space-optimized code relative to 4.5.x)
2011-09-07 Richard Guenther <rguenther@suse.de> PR tree-optimization/50213 * tree-flow.h (simple_iv_increment_p): Declare. * tree-ssa-dom.c (simple_iv_increment_p): Export. Also handle POINTER_PLUS_EXPR. * tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Do not propagate simple IV counter increments. From-SVN: r178633
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r--gcc/tree-ssa-forwprop.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 89d6239..ae37095 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -2377,21 +2377,23 @@ ssa_forward_propagate_and_combine (void)
else
gsi_next (&gsi);
}
- else if (code == POINTER_PLUS_EXPR && can_propagate_from (stmt))
+ else if (code == POINTER_PLUS_EXPR)
{
- if (TREE_CODE (gimple_assign_rhs2 (stmt)) == INTEGER_CST
+ tree off = gimple_assign_rhs2 (stmt);
+ if (TREE_CODE (off) == INTEGER_CST
+ && can_propagate_from (stmt)
+ && !simple_iv_increment_p (stmt)
/* ??? Better adjust the interface to that function
instead of building new trees here. */
&& forward_propagate_addr_expr
- (lhs,
- build1 (ADDR_EXPR,
- TREE_TYPE (rhs),
- fold_build2 (MEM_REF,
- TREE_TYPE (TREE_TYPE (rhs)),
- rhs,
- fold_convert
- (ptr_type_node,
- gimple_assign_rhs2 (stmt))))))
+ (lhs,
+ build1_loc (gimple_location (stmt),
+ ADDR_EXPR, TREE_TYPE (rhs),
+ fold_build2 (MEM_REF,
+ TREE_TYPE (TREE_TYPE (rhs)),
+ rhs,
+ fold_convert (ptr_type_node,
+ off)))))
{
release_defs (stmt);
todoflags |= TODO_remove_unused_locals;