This is the mail archive of the gcc-patches@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]

[patch] Fix PR 43771 - ICE in vectorizer


Hi,

This patch fixes a check if a load permutation is supported by SLP
vectorizer.

Bootstrapped and tested on x86_64-suse-linux. Committed to trunk.

Now testing for 4.5 on x86_64-suse-linux and 4.4 on powerpc64-suse-linux.
OK once the testing completes?

Thanks,
Ira


4.6 and 4.5 patch

ChangeLog:

      PR tree-optimization/43771
      * tree-vect-slp.c (vect_supported_load_permutation_p): Check that
      load permutation doesn't have gaps.

testsuite/ChangeLog:

      PR tree-optimization/43771
      * g++.dg/vect/pr43771.cc: New test.


Index: tree-vect-slp.c
===================================================================
--- tree-vect-slp.c     (revision 158481)
+++ tree-vect-slp.c     (working copy)
@@ -844,7 +844,11 @@ vect_supported_load_permutation_p (slp_i

       SET_BIT (load_index, prev);
     }
-
+
+  for (j = 0; j < group_size; j++)
+    if (!TEST_BIT (load_index, j))
+      return false;
+
   sbitmap_free (load_index);

   if (supported && i == group_size * group_size
Index: testsuite/g++.dg/vect/pr43771.cc
===================================================================
--- testsuite/g++.dg/vect/pr43771.cc    (revision 0)
+++ testsuite/g++.dg/vect/pr43771.cc    (revision 0)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+void KWayNodeRefine__(int nparts, int *gpwgts, int *badminpwgt, int
+*badmaxpwgt)
+{
+   int i;
+
+   for (i=0; i<nparts; i+=2) {
+       badminpwgt[i] = badminpwgt[i+1] = gpwgts[i]+gpwgts[i+1];
+       badmaxpwgt[i] = badmaxpwgt[i+1] = gpwgts[i]+gpwgts[i+1];
+   }
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */



4.4 patch

ChangeLog:

      PR tree-optimization/43771
      * tree-vect-analyze.c (vect_supported_load_permutation_p): Check
      that load permutation doesn't have gaps.

testsuite/ChangeLog:

      PR tree-optimization/43771
      * g++.dg/vect/pr43771.cc: New test.

Index: tree-vect-analyze.c
===================================================================
--- tree-vect-analyze.c (revision 158481)
+++ tree-vect-analyze.c (working copy)
@@ -3260,6 +3260,10 @@ vect_supported_load_permutation_p (slp_i
       SET_BIT (load_index, prev);
     }

+  for (j = 0; j < group_size; j++)
+    if (!TEST_BIT (load_index, j))
+      return false;
+
   sbitmap_free (load_index);

   if (supported && i == group_size * group_size
Index: testsuite/g++.dg/vect/pr43771.cc
===================================================================
--- testsuite/g++.dg/vect/pr43771.cc    (revision 0)
+++ testsuite/g++.dg/vect/pr43771.cc    (revision 0)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+void KWayNodeRefine__(int nparts, int *gpwgts, int *badminpwgt, int
+*badmaxpwgt)
+{
+   int i;
+
+   for (i=0; i<nparts; i+=2) {
+       badminpwgt[i] = badminpwgt[i+1] = gpwgts[i]+gpwgts[i+1];
+       badmaxpwgt[i] = badmaxpwgt[i+1] = gpwgts[i]+gpwgts[i+1];
+   }
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */


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