[patch, vectorizer] Fix PR tree-optimization/36119 (committed)

Ira Rosen IRAR@il.ibm.com
Mon May 5 07:53:00 GMT 2008


Hi,

This patch fixes a failure in loop-aware SLP. Since SLP currently does not
support multiple types, in the analysis phase we check that there is only
one type in the loop before we try to SLP it. In loop-based vectorization
of loops with multiple types we generate "copies" of statements of the
bigger type, and the number of copies is vectorization factor divided by
the number of elements in the vector. In SLP this expression is
meaningless, therefore, we overwrite NCOPIES with 1 (which is the correct
number of copies in case there is only one type in the loop). This patch
adds this part to vectorizable_assignment ().

Bootstrapped with vectorization enabled and tested on x86_64 for trunk and
on ppc_linux for 4.3.1. Pre-approved by Richard in Bugzilla. Committed to
4.4 and 4.3.1.

Thanks,
Ira

ChangeLog:

      PR tree-optimization/36119
      * tree-vect-transform.c (vectorizable_assignment): Set NCOPIES to 1
      in case of SLP.


Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog (revision 134943)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2008-05-05  Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/36119
+       * gfortran.dg/vect/pr36119.f: New test.
+
 2008-05-04  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR libfortran/35995
Index: testsuite/gfortran.dg/vect/pr36119.f
===================================================================
--- testsuite/gfortran.dg/vect/pr36119.f        (revision 0)
+++ testsuite/gfortran.dg/vect/pr36119.f        (revision 0)
@@ -0,0 +1,29 @@
+! { dg-do compile { target { i?86-*-* x86_64-*-* } } }
+! { dg-options "-O3 -mfpmath=sse -msse2 -ffree-form" }
+!
+SUBROUTINE check_dnucint_ana (dcore)
+  IMPLICIT NONE
+  INTEGER, PARAMETER :: dp=8
+  REAL(dp), DIMENSION(10, 2), INTENT(IN),&
+       OPTIONAL                            :: dcore
+  INTEGER                                  :: i, j
+  REAL(dp)                                 :: delta, nssss, od, rn, ssssm,
&
+       ssssp
+  REAL(dp), DIMENSION(10, 2)               :: corem, corep, ncore
+  LOGICAL                                  :: check_value
+
+  delta = 1.0E-8_dp
+  od = 0.5_dp/delta
+  ncore = od * (corep - corem)
+  nssss = od * (ssssp - ssssm)
+  IF (PRESENT(dcore)) THEN
+     DO i = 1, 2
+        DO j = 1, 10)
+           IF (.NOT.check_value(ncore(j,i), dcore(j,i), delta, 0.1_dp))
THEN
+           END IF
+        END DO
+     END DO
+  END IF
+END SUBROUTINE check_dnucint_ana
+
+! { dg-final { cleanup-tree-dump "vect" } }
Index: tree-vect-transform.c
===================================================================
--- tree-vect-transform.c       (revision 134943)
+++ tree-vect-transform.c       (working copy)
@@ -3668,6 +3668,11 @@ vectorizable_assignment (tree stmt, bloc
   VEC(tree,heap) *vec_oprnds = NULL;
   tree vop;

+  /* FORNOW: SLP with multiple types is not supported. The SLP analysis
+     verifies this, so we can safely override NCOPIES with 1 here.  */
+  if (slp_node)
+    ncopies = 1;
+
   gcc_assert (ncopies >= 1);
   if (ncopies > 1)
     return false; /* FORNOW */



More information about the Gcc-patches mailing list