OSDN Git Service

2009-11-18 Sebastian Pop <sebastian.pop@amd.com>
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Nov 2009 05:35:58 +0000 (05:35 +0000)
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Nov 2009 05:35:58 +0000 (05:35 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154641 138bc75d-0d04-0410-961f-82ee72b054a4

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

index ba942d5..37da0f6 100644 (file)
@@ -1,5 +1,13 @@
 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
        * testsuite/gfortran.dg/graphite/pr42050.f90: New.
 
index e3f33e2..2cae2ce 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;
 }