summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-niter.c
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-22 23:05:05 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-22 23:05:05 +0000
commit45dbd04b6e288cd58f3bb0b8ad028475be09119b (patch)
tree365bdf9d6b8498fde007508ac75cee89226d9071 /gcc/tree-ssa-loop-niter.c
parentfd54f19ccbe7d82f2b33c7a6bbaf7d7de1cbb5c5 (diff)
downloadgcc-45dbd04b6e288cd58f3bb0b8ad028475be09119b.tar.gz
2007-08-22 Zdenek Dvorak <ook@ucw.cz>
PR tree-optimization/32949 * tree-ssa-loop-niter.c (scev_probably_wraps_p): Test nowrap_type_p before failing for ivs with non-constant step. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127720 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-niter.c')
-rw-r--r--gcc/tree-ssa-loop-niter.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index 6d1834ec5e4..40e7051c265 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -2969,8 +2969,7 @@ scev_probably_wraps_p (tree base, tree step,
2032, 2040, 0, 8, ..., but the code is still legal. */
if (chrec_contains_undetermined (base)
- || chrec_contains_undetermined (step)
- || TREE_CODE (step) != INTEGER_CST)
+ || chrec_contains_undetermined (step))
return true;
if (integer_zerop (step))
@@ -2981,6 +2980,11 @@ scev_probably_wraps_p (tree base, tree step,
if (use_overflow_semantics && nowrap_type_p (type))
return false;
+ /* To be able to use estimates on number of iterations of the loop,
+ we must have an upper bound on the absolute value of the step. */
+ if (TREE_CODE (step) != INTEGER_CST)
+ return true;
+
/* Don't issue signed overflow warnings. */
fold_defer_overflow_warnings ();