summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-niter.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-07 13:07:22 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-07 13:07:22 +0000
commitf8540d49ff8474424fbe5b735f91318cf2c62f4b (patch)
tree3dd46ae043a71d836aae430f74c237ff07adf664 /gcc/tree-ssa-loop-niter.c
parentb4a7fde1a480d659c71dfedec2ddaaf7dcd2c998 (diff)
downloadgcc-f8540d49ff8474424fbe5b735f91318cf2c62f4b.tar.gz
2006-05-07 Richard Guenther <rguenther@suse.de>
PR tree-optimization/27136 * tree-ssa-loop-niter.c (get_val_for): Correct function comment, assert requirements. (loop_niter_by_eval): Stop processing if the iterated value did not simplify. * gcc.dg/torture/pr27136.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113601 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-niter.c')
-rw-r--r--gcc/tree-ssa-loop-niter.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index bc359ad309f..a3c5791208f 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -1301,7 +1301,7 @@ get_base_for (struct loop *loop, tree x)
/* Given an expression X, then
- * if BASE is NULL_TREE, X must be a constant and we return X.
+ * if X is NULL_TREE, we return the constant BASE.
* otherwise X is a SSA name, whose value in the considered loop is derived
by a chain of operations with constant from a result of a phi node in
the header of the loop. Then we return value of X when the value of the
@@ -1314,6 +1314,8 @@ get_val_for (tree x, tree base)
use_operand_p op;
ssa_op_iter iter;
+ gcc_assert (is_gimple_min_invariant (base));
+
if (!x)
return base;
@@ -1414,7 +1416,11 @@ loop_niter_by_eval (struct loop *loop, edge exit)
}
for (j = 0; j < 2; j++)
- val[j] = get_val_for (next[j], val[j]);
+ {
+ val[j] = get_val_for (next[j], val[j]);
+ if (!is_gimple_min_invariant (val[j]))
+ return chrec_dont_know;
+ }
}
return chrec_dont_know;