From 779ae320bfadc5d867ecaeddf394838d546b57b9 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 3 Jun 2020 14:06:20 +0200 Subject: [PATCH] tree-optimization/95495 - use SLP_TREE_REPRESENTATIVE in assertion This fixes a place where I missed to use SLP_TREE_REPRESENTATIVE after its introduction. 2020-06-03 Richard Biener PR tree-optimization/95495 * tree-vect-slp.c (vect_slp_analyze_node_operations): Use SLP_TREE_REPRESENTATIVE in the shift assertion. * gcc.dg/vect/pr95495.c: New testcase. --- gcc/testsuite/gcc.dg/vect/pr95495.c | 16 ++++++++++++++++ gcc/tree-vect-slp.c | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/vect/pr95495.c diff --git a/gcc/testsuite/gcc.dg/vect/pr95495.c b/gcc/testsuite/gcc.dg/vect/pr95495.c new file mode 100644 index 00000000000..a961aef59fc --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr95495.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ + +typedef struct { + int a; + int b; +} c; +int d, f, g; +c e[4]; +void +h() +{ + for (; f; f++) { + g += e[f].a >> 1 | e[f].a & 1; + d += e[f].b >> 1 | e[f].b & 1; + } +} diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index f1d61944ae0..cc33b64454c 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -2888,7 +2888,7 @@ vect_slp_analyze_node_operations (vec_info *vinfo, slp_tree node, /* For shifts with a scalar argument we don't need to cost or code-generate anything. ??? Represent this more explicitely. */ - gcc_assert ((STMT_VINFO_TYPE (SLP_TREE_SCALAR_STMTS (node)[0]) + gcc_assert ((STMT_VINFO_TYPE (SLP_TREE_REPRESENTATIVE (node)) == shift_vec_info_type) && j == 1); continue; -- 2.30.2