re PR tree-optimization/64404 (ICE: in vect_get_vec_def_for_operand, at tree-vect...
authorRichard Biener <rguenther@suse.de>
Tue, 13 Jan 2015 12:35:27 +0000 (12:35 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 13 Jan 2015 12:35:27 +0000 (12:35 +0000)
2015-01-13  Richard Biener  <rguenther@suse.de>

PR tree-optimization/64404
* tree-vect-stmts.c (vectorizable_load): Reject conflicting
SLP types for CSEd loads.

* gcc.dg/vect/pr64404.c: New testcase.

From-SVN: r219527

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

index 4700629..d99589b 100644 (file)
@@ -1,3 +1,9 @@
+2015-01-13  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/64404
+       * tree-vect-stmts.c (vectorizable_load): Reject conflicting
+       SLP types for CSEd loads.
+
 2015-01-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        PR tree-optimization/64436
index bd4d1d0..854d5f4 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-13  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/64404
+       * gcc.dg/vect/pr64404.c: New testcase.
+
 2014-01-13  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/64568
diff --git a/gcc/testsuite/gcc.dg/vect/pr64404.c b/gcc/testsuite/gcc.dg/vect/pr64404.c
new file mode 100644 (file)
index 0000000..aa6463c
--- /dev/null
@@ -0,0 +1,59 @@
+/* { dg-do run } */
+/* { dg-additional-options "--param=sccvn-max-alias-queries-per-access=1" } */
+
+#include "tree-vect.h"
+
+extern void abort (void);
+
+typedef struct
+{
+  int l, h;
+} tFPinterval;
+
+tFPinterval X[1024];
+tFPinterval Y[1024];
+tFPinterval Z[1024];
+
+void __attribute__((noinline))
+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;
+    }
+}
+
+int
+main (void)
+{
+  int d;
+
+  check_vect ();
+
+  for (d = 0; d < 1024; d++)
+    {
+      X[d].l = d;
+      X[d].h = d + 1;
+      __asm__ volatile ("");
+    }
+
+  Compute ();
+
+  for (d = 0; d < 1024; d++)
+    {
+      if (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)
+       abort ();
+      __asm__ volatile ("");
+    }
+
+  return 0;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
index 1b79ace..43fc51c 100644 (file)
@@ -5791,6 +5791,20 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
                             "group loads with negative dependence distance\n");
          return false;
        }
+
+      /* Similarly when the stmt is a load that is both part of a SLP
+         instance and a loop vectorized stmt via the same-dr mechanism
+        we have to give up.  */
+      if (STMT_VINFO_GROUP_SAME_DR_STMT (stmt_info)
+         && (STMT_SLP_TYPE (stmt_info)
+             != STMT_SLP_TYPE (vinfo_for_stmt
+                                (STMT_VINFO_GROUP_SAME_DR_STMT (stmt_info)))))
+       {
+         if (dump_enabled_p ())
+           dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+                            "conflicting SLP types for CSEd load\n");
+         return false;
+       }
     }