From: Richard Biener Date: Wed, 3 Jun 2020 12:06:20 +0000 (+0200) Subject: tree-optimization/95495 - use SLP_TREE_REPRESENTATIVE in assertion X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=779ae320bfadc5d867ecaeddf394838d546b57b9;p=gcc.git 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. --- 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;