From: Richard Biener Date: Mon, 29 Jun 2020 11:53:51 +0000 (+0200) Subject: tree-optimization/95916 - treat scalar ops explicitely X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9a4a52e359ba16a2516a735dca838af512b19336;p=gcc.git 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 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. --- diff --git a/gcc/testsuite/gcc.dg/vect/pr95916.c b/gcc/testsuite/gcc.dg/vect/pr95916.c new file mode 100644 index 00000000000..61b8ca3fa0c --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr95916.c @@ -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; +} diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index b223956e3af..1ffbf6f6af9 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -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