re PR middle-end/40281 (-fprefetch-loop-arrays: ICE: in initialize_matrix_A, at tree...
authorSebastian Pop <sebastian.pop@amd.com>
Wed, 25 Nov 2009 05:35:58 +0000 (05:35 +0000)
committerSebastian Pop <spop@gcc.gnu.org>
Wed, 25 Nov 2009 05:35:58 +0000 (05:35 +0000)
2009-11-18  Sebastian Pop  <sebastian.pop@amd.com>

PR middle-end/40281
* testsuite/gcc.dg/graphite/pr40281.c: New.

* tree-scalar-evolution.c (instantiate_scev_poly): Base and stride
evolutions should not variate in inner loops.

From-SVN: r154641

gcc/ChangeLog.graphite
gcc/tree-scalar-evolution.c

index ba942d564422cfeb77467d826395aafd2f0d3069..37da0f6856f1f190e997528b972cc5db3de80133 100644 (file)
@@ -1,3 +1,11 @@
+2009-11-18  Sebastian Pop  <sebastian.pop@amd.com>
+
+       PR middle-end/40281
+       * testsuite/gcc.dg/graphite/pr40281.c: New.
+
+       * tree-scalar-evolution.c (instantiate_scev_poly): Base and stride
+       evolutions should not variate in inner loops.
+
 2009-11-18  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR middle-end/42050
index e3f33e2ef9626a5417b7f038164dc67a4dd66a0c..2cae2ceff458704701ce6711721243dbc36c0a35 100644 (file)
@@ -2226,9 +2226,21 @@ instantiate_scev_poly (basic_block instantiate_below,
   if (CHREC_LEFT (chrec) != op0
       || CHREC_RIGHT (chrec) != op1)
     {
+      unsigned var = CHREC_VARIABLE (chrec);
+
+      /* When the instantiated stride or base has an evolution in an
+        innermost loop, return chrec_dont_know, as this is not a
+        valid SCEV representation.  In the reduced testcase for
+        PR40281 we would have {0, +, {1, +, 1}_2}_1 that has no
+        meaning.  */
+      if ((tree_is_chrec (op0) && CHREC_VARIABLE (op0) > var)
+         || (tree_is_chrec (op1) && CHREC_VARIABLE (op1) > var))
+       return chrec_dont_know;
+
       op1 = chrec_convert_rhs (chrec_type (op0), op1, NULL);
-      chrec = build_polynomial_chrec (CHREC_VARIABLE (chrec), op0, op1);
+      chrec = build_polynomial_chrec (var, op0, op1);
     }
+
   return chrec;
 }