[Bug tree-optimization/47001] segmentation fault in vect_mark_slp_stmts

2010-12-23 Thread irar at il dot ibm.com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47001

Ira Rosen irar at il dot ibm.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED

--- Comment #3 from Ira Rosen irar at il dot ibm.com 2010-12-23 16:31:43 UTC 
---
Fixed.


[Bug tree-optimization/47001] segmentation fault in vect_mark_slp_stmts

2010-12-21 Thread irar at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47001

--- Comment #2 from irar at gcc dot gnu.org 2010-12-21 15:42:15 UTC ---
Author: irar
Date: Tue Dec 21 15:42:11 2010
New Revision: 168123

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=168123
Log:

PR tree-optimization/47001
* tree-vect-slp.c (vect_supported_load_permutation_p): Check
that the loads in reduction are different and there are no gaps
between them.


Added:
trunk/gcc/testsuite/gcc.dg/vect/pr47001.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-vect-slp.c


[Bug tree-optimization/47001] segmentation fault in vect_mark_slp_stmts

2010-12-20 Thread irar at il dot ibm.com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47001

Ira Rosen irar at il dot ibm.com changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2010.12.20 09:00:13
 CC||irar at il dot ibm.com
 AssignedTo|unassigned at gcc dot   |irar at gcc dot gnu.org
   |gnu.org |
 Ever Confirmed|0   |1

--- Comment #1 from Ira Rosen irar at il dot ibm.com 2010-12-20 09:00:13 UTC 
---
The vectorizer tries to do SLP for reduction here, but there is only one scalar
load for both reductions, which is not supported, but also is not checked. I am
testing a patch that adds such check.

Index: tree-vect-slp.c
===
--- tree-vect-slp.c (revision 167365)
+++ tree-vect-slp.c (working copy)
@@ -1002,7 +1002,35 @@ vect_supported_load_permutation_p (slp_i

   if (!bad_permutation)
 {
-  /* This permutaion is valid for reduction.  Since the order of the
+  /* Check that all the loads are different.  */
+  load_index = sbitmap_alloc (group_size);
+  sbitmap_zero (load_index);
+  for (k = 0; k  group_size; k++)
+{
+  first_group_load_index = VEC_index (int, load_permutation, k);
+  if (TEST_BIT (load_index, first_group_load_index))
+{
+  bad_permutation = true;
+  break;
+}
+
+  SET_BIT (load_index, first_group_load_index);
+}
+
+  if (!bad_permutation)
+for (k = 0; k  group_size; k++)
+  if (!TEST_BIT (load_index, k))
+{
+  bad_permutation = true;
+  break;
+}
+
+  sbitmap_free (load_index);
+}
+
+  if (!bad_permutation)
+{
+  /* This permutation is valid for reduction.  Since the order of the
  statements in the nodes is not important unless they are memory
  accesses, we can rearrange the statements in all the nodes
  according to the order of the loads.  */


Ira