re PR tree-optimization/56270 (loop over array of struct float causes compiler error...
authorRichard Biener <rguenther@suse.de>
Tue, 5 Mar 2013 09:54:29 +0000 (09:54 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 5 Mar 2013 09:54:29 +0000 (09:54 +0000)
2013-03-05  Richard Biener  <rguenther@suse.de>

PR tree-optimization/56270
* tree-vect-slp.c (vect_schedule_slp): Clear vectorized stmts
of loads after scheduling an SLP instance.

* gcc.dg/vect/slp-38.c: New testcase.

From-SVN: r196458

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

index 8d359778e6aed316e5d5835656018942c3348a74..b09e4270e0cbec26794a177e5625f97770694c84 100644 (file)
@@ -1,3 +1,9 @@
+2013-03-05  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/56270
+       * tree-vect-slp.c (vect_schedule_slp): Clear vectorized stmts
+       of loads after scheduling an SLP instance.
+
 2013-03-05  Jakub Jelinek  <jakub@redhat.com>
 
        * Makefile.in (dg_target_exps): Add aarch64.exp, epiphany.exp and
index 4529bcfc8bf578011e353d682459174694aa033d..6cbe85ee00a208cebf76e78515cdf84ebb724192 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-05  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/56270
+       * gcc.dg/vect/slp-38.c: New testcase.
+
 2013-03-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/56494
diff --git a/gcc/testsuite/gcc.dg/vect/slp-38.c b/gcc/testsuite/gcc.dg/vect/slp-38.c
new file mode 100644 (file)
index 0000000..a387f5d
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+
+typedef struct {
+    float l, h;
+} tFPinterval;
+
+tFPinterval X[1024];
+tFPinterval Y[1024];
+tFPinterval Z[1024];
+
+void Compute(void)
+{
+  int d;
+  for (d= 0; d < 1024; d++)
+    {
+      Y[d].l= X[d].l + X[d].h;
+      Y[d].h= Y[d].l;
+      Z[d].l= X[d].l;
+      Z[d].h= X[d].h;
+    }
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 1 "vect" { target { vect_float && vect_perm } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
index 467abb579247b37a93571521952d1b82f14231e1..3b2fc8013bad76e4913360fd7a35393c4eca3178 100644 (file)
@@ -3141,7 +3141,8 @@ vect_schedule_slp (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
 {
   vec<slp_instance> slp_instances;
   slp_instance instance;
-  unsigned int i, vf;
+  slp_tree loads_node;
+  unsigned int i, j, vf;
   bool is_store = false;
 
   if (loop_vinfo)
@@ -3160,6 +3161,14 @@ vect_schedule_slp (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
       /* Schedule the tree of INSTANCE.  */
       is_store = vect_schedule_slp_instance (SLP_INSTANCE_TREE (instance),
                                              instance, vf);
+
+      /* Clear STMT_VINFO_VEC_STMT of all loads.  With shared loads
+         between SLP instances we fail to properly initialize the
+        vectorized SLP stmts and confuse different load permutations.  */
+      FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (instance), j, loads_node)
+       STMT_VINFO_VEC_STMT
+         (vinfo_for_stmt (SLP_TREE_SCALAR_STMTS (loads_node)[0])) = NULL;
+
       if (dump_enabled_p ())
        dump_printf_loc (MSG_NOTE, vect_location,
                          "vectorizing stmts using SLP.");