]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/41956 (Segfault in vectorizer)
authorIra Rosen <irar@il.ibm.com>
Wed, 30 Dec 2009 12:53:18 +0000 (12:53 +0000)
committerIra Rosen <irar@gcc.gnu.org>
Wed, 30 Dec 2009 12:53:18 +0000 (12:53 +0000)
PR tree-optimization/41956
* tree-vect-slp.c (vect_supported_load_permutation_p): Add check that
the load indices differ.

From-SVN: r155523

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr41956.c [new file with mode: 0644]
gcc/tree-vect-slp.c

index 8076302d94b02b92113b3ff3de3d6918121b3899..9b4a6fe941280ad788e658d1991a581a3d8dfe0d 100644 (file)
@@ -1,3 +1,9 @@
+2009-12-30  Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/41956
+       * tree-vect-slp.c (vect_supported_load_permutation_p): Add check that 
+       the load indices differ.
+
 2009-12-30  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/42549
index 99f3dafa8195c8106e0729799172663fb9c3b43b..1c49c2d5a37941b262b5d05df9d39a0f759f879a 100644 (file)
@@ -1,3 +1,8 @@
+2009-12-30  Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/41956
+       * gcc.dg/vect/pr41956.c: New test.
+
 2009-12-30  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/42549
diff --git a/gcc/testsuite/gcc.dg/vect/pr41956.c b/gcc/testsuite/gcc.dg/vect/pr41956.c
new file mode 100644 (file)
index 0000000..455f505
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+
+void K (int *gpwgts, int *badminpwgt, int *badmaxpwgt)
+{
+  int i;
+  for (i = 0; i < 10; i += 2) {
+    badminpwgt[i] = badminpwgt[i+1] = gpwgts[i]+gpwgts[i];
+    badmaxpwgt[i] = badmaxpwgt[i+1] = gpwgts[i]+gpwgts[i];
+  }
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
index 3222f8b450e005cc16eda974cc645bf09c5b9ec5..a3be6786d94a3918ad572e4ae6c2cb53d8988c39 100644 (file)
@@ -796,6 +796,7 @@ vect_supported_load_permutation_p (slp_instance slp_instn, int group_size,
 {
   int i = 0, j, prev = -1, next, k;
   bool supported;
+  sbitmap load_index;
 
   /* FORNOW: permutations are only supported in SLP.  */
   if (!slp_instn)
@@ -816,6 +817,8 @@ vect_supported_load_permutation_p (slp_instance slp_instn, int group_size,
     return false;
 
   supported = true;
+  load_index = sbitmap_alloc (group_size);
+  sbitmap_zero (load_index);
   for (j = 0; j < group_size; j++)
     {
       for (i = j * group_size, k = 0;
@@ -830,7 +833,17 @@ vect_supported_load_permutation_p (slp_instance slp_instn, int group_size,
 
          prev = next;
        }
+
+      if (TEST_BIT (load_index, prev))
+        {
+          supported = false;
+          break;
+        }
+
+      SET_BIT (load_index, prev);
     }
+  
+  sbitmap_free (load_index);
 
   if (supported && i == group_size * group_size
       && vect_supported_slp_permutation_p (slp_instn))