This fixes PR56812 - the vectorizer TLC got rid of special-casing
interleaving chain members in data dependence analysis.  I re-instantiated
that after having a quick look why dependence analysis doesn't
disambiguate them (it should - known issue, on my TODO list).
And added a testcase to make sure we don't regress.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2013-04-03  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/56812
        * tree-vect-data-refs.c (vect_slp_analyze_data_ref_dependence):
        DRs of the same interleaving chain are independent.

        * g++.dg/vect/slp-pr56812.cc: New testcase.

Index: gcc/tree-vect-data-refs.c
===================================================================
*** gcc/tree-vect-data-refs.c   (revision 197356)
--- gcc/tree-vect-data-refs.c   (working copy)
*************** vect_slp_analyze_data_ref_dependence (st
*** 484,489 ****
--- 484,496 ----
    if (DR_IS_READ (dra) && DR_IS_READ (drb))
      return false;
  
+   /* If dra and drb are part of the same interleaving chain consider
+      them independent.  */
+   if (STMT_VINFO_GROUPED_ACCESS (vinfo_for_stmt (DR_STMT (dra)))
+       && (GROUP_FIRST_ELEMENT (vinfo_for_stmt (DR_STMT (dra)))
+         == GROUP_FIRST_ELEMENT (vinfo_for_stmt (DR_STMT (drb)))))
+     return false;
+ 
    /* Unknown data dependence.  */
    if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
      {
Index: gcc/testsuite/g++.dg/vect/slp-pr56812.cc
===================================================================
*** gcc/testsuite/g++.dg/vect/slp-pr56812.cc    (revision 0)
--- gcc/testsuite/g++.dg/vect/slp-pr56812.cc    (working copy)
***************
*** 0 ****
--- 1,20 ----
+ /* { dg-do compile } */
+ /* { dg-require-effective-target vect_float } */
+ /* { dg-options "-O3 -funroll-loops -fdump-tree-slp-details" } */
+ 
+ class mydata {
+ public:
+     mydata() {Set(-1.0);}
+     void Set (float);
+     static int upper() {return 8;}
+     float data[8];
+ };
+ 
+ void mydata::Set (float x)
+ {
+   for (int i=0; i<upper(); i++)
+     data[i] = x;
+ }
+ 
+ /* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 
"slp" } } */
+ /* { dg-final { cleanup-tree-dump "slp" } } */

Reply via email to