From 1e1e1edf88a7c40ae4ae0de9e6077179e13ccf6d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 29 Oct 2020 08:48:15 +0100 Subject: [PATCH] More BB vectorization tweaks This tweaks the op build from splats to allow loads marked as not vectorizable. It also amends some dump prints with the address of the SLP node or the instance to better be able to debug things. 2020-10-29 Richard Biener * tree-vect-slp.c (vect_build_slp_tree_2): Allow splatting not vectorizable loads. (vect_build_slp_instance): Amend dumping with address. (vect_slp_convert_to_external): Likewise. * gcc.dg/vect/bb-slp-pr65935.c: Adjust. --- gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c | 5 +++-- gcc/tree-vect-slp.c | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c index ea37e4e614c..c262d731150 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c @@ -60,6 +60,7 @@ int main() /* We should also be able to use 2-lane SLP to initialize the real and imaginary components in the first loop of main. */ /* { dg-final { scan-tree-dump-times "optimized: basic block" 10 "slp1" } } */ -/* We should see the s->phase[dir] operand and only that operand built +/* We should see the s->phase[dir] operand splatted and no other operand built from scalars. See PR97334. */ -/* { dg-final { scan-tree-dump-times "Building vector operands from scalars" 1 "slp1" } } */ +/* { dg-final { scan-tree-dump-times "Using a splat" 1 "slp1" } } */ +/* { dg-final { scan-tree-dump-times "Building vector operands from scalars" 0 "slp1" } } */ diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index ff3a0c2fd8e..0a7b8e61632 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -1627,8 +1627,10 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node, break; if (j == group_size /* But avoid doing this for loads where we may be - able to CSE things. */ - && !gimple_vuse (first_def->stmt)) + able to CSE things, unless the stmt is not + vectorizable. */ + && (!STMT_VINFO_VECTORIZABLE (first_def) + || !gimple_vuse (first_def->stmt))) { if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location, @@ -2379,7 +2381,7 @@ vect_build_slp_instance (vec_info *vinfo, if (dump_enabled_p ()) { dump_printf_loc (MSG_NOTE, vect_location, - "Final SLP tree for instance:\n"); + "Final SLP tree for instance %p:\n", new_instance); vect_print_slp_graph (MSG_NOTE, vect_location, SLP_INSTANCE_TREE (new_instance)); } @@ -3402,7 +3404,7 @@ vect_slp_convert_to_external (vec_info *vinfo, slp_tree node, if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location, - "Building vector operands from scalars instead\n"); + "Building vector operands of %p from scalars instead\n", node); /* Don't remove and free the child nodes here, since they could be referenced by other structures. The analysis and scheduling phases -- 2.30.2