summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dom.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-07 11:28:39 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-07 11:28:39 +0000
commitcd22a7968a89e465b934b7b2b9ff685a9652601b (patch)
treec6bedca9793378da04071c4b6c255b9f6de8eec4 /gcc/tree-ssa-dom.c
parentbdcd46972d7df975376991a30a49b16f451ed6e2 (diff)
downloadgcc-cd22a7968a89e465b934b7b2b9ff685a9652601b.tar.gz
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: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178633 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r--gcc/tree-ssa-dom.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 7a00c8ad937..18923aede7b 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -1409,9 +1409,10 @@ record_equality (tree x, tree y)
i_1 = phi (..., i_2)
i_2 = i_1 +/- ... */
-static bool
+bool
simple_iv_increment_p (gimple stmt)
{
+ enum tree_code code;
tree lhs, preinc;
gimple phi;
size_t i;
@@ -1423,12 +1424,13 @@ simple_iv_increment_p (gimple stmt)
if (TREE_CODE (lhs) != SSA_NAME)
return false;
- if (gimple_assign_rhs_code (stmt) != PLUS_EXPR
- && gimple_assign_rhs_code (stmt) != MINUS_EXPR)
+ code = gimple_assign_rhs_code (stmt);
+ if (code != PLUS_EXPR
+ && code != MINUS_EXPR
+ && code != POINTER_PLUS_EXPR)
return false;
preinc = gimple_assign_rhs1 (stmt);
-
if (TREE_CODE (preinc) != SSA_NAME)
return false;