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  <rguenther@suse.de>

	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.
This commit is contained in:
Richard Biener 2020-06-03 14:06:20 +02:00
parent 079632de49
commit 779ae320bf
2 changed files with 17 additions and 1 deletions

View File

@ -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;
}
}

View File

@ -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;