[patch, commited] for PR 32949
Zdenek Dvorak
rakdver@kam.mff.cuni.cz
Wed Aug 22 22:58:00 GMT 2007
Hello,
for variables in nowrap types whose evolution is [something, + step]
and step is not constant, we currently claim that they may wrap. This
patch moves the cheking that the step is a constant (that is necessary
for analysis of wrapping based on the estimates on number of iterations
of loop) after the type check (that is correct even if the step is a
loop-invariant variable).
Bootstrapped & regtested on i686, commited.
Zdenek
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.
Index: tree-ssa-loop-niter.c
===================================================================
*** tree-ssa-loop-niter.c (revision 127674)
--- tree-ssa-loop-niter.c (working copy)
*************** scev_probably_wraps_p (tree base, tree s
*** 2969,2976 ****
2032, 2040, 0, 8, ..., but the code is still legal. */
if (chrec_contains_undetermined (base)
! || chrec_contains_undetermined (step)
! || TREE_CODE (step) != INTEGER_CST)
return true;
if (integer_zerop (step))
--- 2969,2975 ----
2032, 2040, 0, 8, ..., but the code is still legal. */
if (chrec_contains_undetermined (base)
! || chrec_contains_undetermined (step))
return true;
if (integer_zerop (step))
*************** scev_probably_wraps_p (tree base, tree s
*** 2981,2986 ****
--- 2980,2990 ----
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 ();
More information about the Gcc-patches
mailing list