This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/40281] [4.4/4.5 Regression] -fprefetch-loop-arrays: ICE: in initialize_matrix_A, at tree-data-ref.c:1887



------- Comment #8 from spop at gcc dot gnu dot org  2009-11-19 22:14 -------
Subject: Re:  [4.4/4.5 Regression] -fprefetch-loop-arrays: 
        ICE: in initialize_matrix_A, at tree-data-ref.c:1887

Hi,

Here is a fix for this one, on top of the graphite branch.
I will commit this fix to the graphite branch to run the automatic testers,
and then it will be included in the merge from graphite to trunk.

Sebastian

diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index fcd3382..7321b6e 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -2215,9 +2215,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;
 }


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40281


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]