tree-optimization/95916 - treat scalar ops explicitely

This explicitely treats the case of scalar operands for SLP
when computing insert locations.

2020-06-29  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/95916
	* tree-vect-slp.c (vect_schedule_slp_instance): Explicitely handle
	the case of not vectorized externals.

	* gcc.dg/vect/pr95916.c: New testcase.
This commit is contained in:
Richard Biener 2020-06-29 13:53:51 +02:00
parent 008842d741
commit 9a4a52e359
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,13 @@
/* { dg-do compile } */
/* { dg-additional-options "-O3" } */
extern short var_3, var_8;
extern int var_5;
extern char var_10;
extern int arr_99[][16];
void test()
{
for (; 0 < var_10;)
for (long a = var_8;; a++)
arr_99[4][a] = var_3 << var_5;
}

View File

@ -4293,6 +4293,21 @@ vect_schedule_slp_instance (vec_info *vinfo,
|| vect_stmt_dominates_stmt_p (last_stmt, vstmt))
last_stmt = vstmt;
}
else if (!SLP_TREE_VECTYPE (child))
{
/* For externals we use unvectorized at all scalar defs. */
unsigned j;
tree def;
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_OPS (child), j, def)
if (TREE_CODE (def) == SSA_NAME
&& !SSA_NAME_IS_DEFAULT_DEF (def))
{
gimple *stmt = SSA_NAME_DEF_STMT (def);
if (!last_stmt
|| vect_stmt_dominates_stmt_p (last_stmt, stmt))
last_stmt = stmt;
}
}
else
{
/* For externals we have to look at all defs since their