re PR tree-optimization/32949 (suboptimal address generation for int indices on 64...
authorZdenek Dvorak <ook@ucw.cz>
Wed, 22 Aug 2007 23:05:05 +0000 (01:05 +0200)
committerZdenek Dvorak <rakdver@gcc.gnu.org>
Wed, 22 Aug 2007 23:05:05 +0000 (23:05 +0000)
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.

From-SVN: r127720

gcc/ChangeLog
gcc/tree-ssa-loop-niter.c

index 0d8dae1c0af35cf3d6324798fc9dd95294afa87a..6594bea4750dcf97c112316841ba0475b005e097 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2007-08-22  Hans-Peter Nilsson  <hp@axis.com>
 
        * doc/md.texi (Iterators): Renamed from Macros.  All contents
index 6d1834ec5e4ba7147e5ba048c3ada85b27b85132..40e7051c265bf9d70dc54ac93179dbf15a8a9b27 100644 (file)
@@ -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 ();