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

--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-10-14 
11:54:13 UTC ---
The snippet seems to work as far as to set SUB_DISTANCE to chrec_dont_know,
together with the suggested fix in comment #5 it fixes this PR.

Now, the hunk below alone would already compute the distance vector,
so I'm not sure what the rest of the function is supposed to do
(and why it doesn't handle steps appropriately).

Index: tree-data-ref.c
===================================================================
--- tree-data-ref.c     (revision 165456)
+++ tree-data-ref.c     (working copy)
@@ -1165,6 +1165,16 @@ compute_subscript_distance (struct data_
              SUB_DISTANCE (subscript) = chrec_dont_know;
              return;
            }
+
+         if (tree_contains_chrecs
+               (chrec_fold_minus (TREE_TYPE (DR_ACCESS_FN (DDR_A (ddr), i)),
+                                  DR_ACCESS_FN (DDR_A (ddr), i),
+                                  DR_ACCESS_FN (DDR_B (ddr), i)), NULL))
+           {
+             SUB_DISTANCE (subscript) = chrec_dont_know;
+             return;
+           }
+
          diff = affine_fn_minus (fn_a, fn_b);

          if (affine_function_constant_p (diff))


It looks like if we ever start to vectorize strided stores then we'd miscompile

  a[i*2] = a[(i+1)*2];

as well.  Here we have no dependence, thus the conflict function should
be no-conflict (which leads us to no distance vector).

Reply via email to