The following patch makes us handle strided group stores in the
vectorizer dependence analysis code as our general dependence
code cannot handle {0, +, s_1} vs. {1, +, s_1} resulting from

 a[i] = ..;
 a[i+1] = ..;
 i+=s;

this prevents the strided store support enhancement from triggering
on symbolic strided stores (it still triggers for constant-step
aka groups with gaps stores).

I also took the opportunity to remove read-read and self dependence
computations - those were never necessary for loop vectorization.

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

Richard.

2016-06-14  Richard Biener  <rguent...@suse.de>

        * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Do
        not consider dependences between accesses that belong to the
        same group.
        (vect_analyze_data_ref_dependences): Do not analyze read-read
        or self-dependences.

Index: gcc/tree-vect-data-refs.c
===================================================================
*** gcc/tree-vect-data-refs.c   (revision 237428)
--- gcc/tree-vect-data-refs.c   (working copy)
*************** vect_analyze_data_ref_dependence (struct
*** 227,232 ****
--- 231,242 ----
        || (DR_IS_READ (dra) && DR_IS_READ (drb)))
      return false;
  
+   /* We do not have to consider dependences between accesses that belong
+      to the same group.  */
+   if (GROUP_FIRST_ELEMENT (stmtinfo_a)
+       && GROUP_FIRST_ELEMENT (stmtinfo_a) == GROUP_FIRST_ELEMENT (stmtinfo_b))
+     return false;
+ 
    /* Even if we have an anti-dependence then, as the vectorized loop covers at
       least two scalar iterations, there is always also a true dependence.
       As the vectorizer does not re-order loads and stores we can ignore
*************** vect_analyze_data_ref_dependences (loop_
*** 469,475 ****
    LOOP_VINFO_NO_DATA_DEPENDENCIES (loop_vinfo) = true;
    if (!compute_all_dependences (LOOP_VINFO_DATAREFS (loop_vinfo),
                                &LOOP_VINFO_DDRS (loop_vinfo),
!                               LOOP_VINFO_LOOP_NEST (loop_vinfo), true))
      return false;
  
    FOR_EACH_VEC_ELT (LOOP_VINFO_DDRS (loop_vinfo), i, ddr)
--- 501,507 ----
    LOOP_VINFO_NO_DATA_DEPENDENCIES (loop_vinfo) = true;
    if (!compute_all_dependences (LOOP_VINFO_DATAREFS (loop_vinfo),
                                &LOOP_VINFO_DDRS (loop_vinfo),
!                               LOOP_VINFO_LOOP_NEST (loop_vinfo), false))
      return false;
  
    FOR_EACH_VEC_ELT (LOOP_VINFO_DDRS (loop_vinfo), i, ddr)

Reply via email to