diff options
author | Richard Guenther <rguenther@suse.de> | 2011-09-07 11:28:39 +0000 |
---|---|---|
committer | Richard Guenther <rguenther@suse.de> | 2011-09-07 11:28:39 +0000 |
commit | 44e9b72a0eb84222d344544c4611fbdaf76b42a3 (patch) | |
tree | c6bedca9793378da04071c4b6c255b9f6de8eec4 /gcc/tree-ssa-forwprop.c | |
parent | 89ba9a887df9ffe3e75c18e214268665c6e4a698 (diff) |
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.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@178633 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r-- | gcc/tree-ssa-forwprop.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index 89d6239836b..ae37095d88e 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; |