From c2c198bfd1e747b761c6b9b13417685bd4378d57 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 8 Dec 2020 09:56:53 +0100 Subject: [PATCH] tree-optimization/98191 - fix BIT_INSERT_EXPR sequence vectorization This adds a missing check. 2020-12-08 Richard Biener 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 | 10 ++++++++++ gcc/tree-vect-slp.c | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr98191.c diff --git a/gcc/testsuite/gcc.dg/torture/pr98191.c b/gcc/testsuite/gcc.dg/torture/pr98191.c new file mode 100644 index 0000000..93cd27c --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr98191.c @@ -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; +} diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index a2757e7..35e7835 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -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; -- 2.7.4