re PR tree-optimization/90358 (526.blender_r train run does not finish after r270847...
authorRichard Biener <rguenther@suse.de>
Mon, 6 May 2019 13:40:00 +0000 (13:40 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 6 May 2019 13:40:00 +0000 (13:40 +0000)
2019-05-06  Richard Biener  <rguenther@suse.de>

PR tree-optimization/90358
* tree-vect-stmts.c (get_group_load_store_type): Properly
detect unused upper half of load.
(vectorizable_load): Likewise.

* gcc.target/i386/pr90358.c: New testcase.

From-SVN: r270911

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr90358.c [new file with mode: 0644]
gcc/tree-vect-stmts.c

index 766123752965c6cc16dd62204224de4396148dac..432b8c15372ed763311153bd508a42973d497901 100644 (file)
@@ -1,3 +1,10 @@
+2019-05-06  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90358
+       * tree-vect-stmts.c (get_group_load_store_type): Properly
+       detect unused upper half of load.
+       (vectorizable_load): Likewise.
+
 2019-05-06  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/88828
index ec1ec51b8a3b2d6894e4d3214d947fb78d8fe5c7..679ac800828f12adfc13c51348ae96f01906146a 100644 (file)
@@ -1,3 +1,8 @@
+2019-05-06  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90358
+       * gcc.target/i386/pr90358.c: New testcase.
+
 2019-05-06  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/88828
diff --git a/gcc/testsuite/gcc.target/i386/pr90358.c b/gcc/testsuite/gcc.target/i386/pr90358.c
new file mode 100644 (file)
index 0000000..4894fdb
--- /dev/null
@@ -0,0 +1,35 @@
+/* PR target/90358 */
+/* { dg-do run { target { sse4_runtime } } } */
+/* { dg-options "-O3 -msse4" } */
+
+struct s { unsigned int a, b, c; };
+
+void __attribute__ ((noipa))
+foo (struct s *restrict s1, struct s *restrict s2, int n)
+{
+  for (int i = 0; i < n; ++i)
+    {
+      s1[i].b = s2[i].b;
+      s1[i].c = s2[i].c;
+      s2[i].c = 0;
+    }
+}
+                            
+#define N 12
+
+int
+main ()
+{
+  struct s s1[N], s2[N];
+  for (unsigned int j = 0; j < N; ++j)
+    {
+      s2[j].a = j * 5;
+      s2[j].b = j * 5 + 2;
+      s2[j].c = j * 5 + 4;
+    }
+  foo (s1, s2, N);
+  for (unsigned int j = 0; j < N; ++j)
+  if (s1[j].b != j * 5 + 2)
+    __builtin_abort ();
+  return 0;
+}
index 247d4353cb5949f492fcd6e6201ab6130a82bbf3..98e6df747e9ad8a2b346ab27c80d9c6208505d90 100644 (file)
@@ -2273,6 +2273,7 @@ get_group_load_store_type (stmt_vec_info stmt_info, tree vectype, bool slp,
                   == dr_aligned
                  || alignment_support_scheme == dr_unaligned_supported)
              && known_eq (nunits, (group_size - gap) * 2)
+             && known_eq (nunits, group_size)
              && mode_for_vector (elmode, (group_size - gap)).exists (&vmode)
              && VECTOR_MODE_P (vmode)
              && targetm.vector_mode_supported_p (vmode)
@@ -8550,7 +8551,8 @@ vectorizable_load (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
                            && DR_GROUP_GAP (first_stmt_info) != 0
                            && known_eq (nunits,
                                         (group_size
-                                         - DR_GROUP_GAP (first_stmt_info)) * 2))
+                                         - DR_GROUP_GAP (first_stmt_info)) * 2)
+                           && known_eq (nunits, group_size))
                          ltype = build_vector_type (TREE_TYPE (vectype),
                                                     (group_size
                                                      - DR_GROUP_GAP