tree-optimization/98191 - fix BIT_INSERT_EXPR sequence vectorization
authorRichard Biener <rguenther@suse.de>
Tue, 8 Dec 2020 08:56:53 +0000 (09:56 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 8 Dec 2020 09:36:47 +0000 (10:36 +0100)
This adds a missing check.

2020-12-08  Richard Biener  <rguenther@suse.de>

PR tree-optimization/98191
* tree-vect-slp.c (vect_slp_check_for_constructors): Do not
follow a non-SSA def chain.

* gcc.dg/torture/pr98191.c: New testcase.

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

diff --git a/gcc/testsuite/gcc.dg/torture/pr98191.c b/gcc/testsuite/gcc.dg/torture/pr98191.c
new file mode 100644 (file)
index 0000000..93cd27c
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+
+typedef double v2df __attribute__((vector_size(2*sizeof(double))));
+
+v2df foo (double *y)
+{
+  v2df x = (v2df){ 1.0, 2.0 };
+  x[0] = *y;
+  return x;
+}
index a2757e707ffdd42eb15341811d80d984604164bf..35e783505b4934fe7eef401f7f60390722e66204 100644 (file)
@@ -4243,7 +4243,8 @@ vect_slp_check_for_constructors (bb_vec_info bb_vinfo)
              def = gimple_assign_rhs1 (assign);
              do
                {
-                 if (!has_single_use (def))
+                 if (TREE_CODE (def) != SSA_NAME
+                     || !has_single_use (def))
                    break;
                  gimple *def_stmt = SSA_NAME_DEF_STMT (def);
                  unsigned this_lane;