Hi Richi, On 09/06/2021 14:42, Richard Biener via Gcc-patches wrote: > On Mon, May 31, 2021 at 5:00 PM Richard Biener <rguent...@suse.de> wrote: > > > > This makes SLP discovery handle associatable (including mixed > > plus/minus) chains better by swapping operands across the whole > > chain. To work this adds caching of the 'matches' lanes for > > failed SLP discovery attempts, thereby fixing a failed SLP > > discovery for the slp-pr98855.cc testcase which results in > > building an operand from scalars as expected. Unfortunately > > this makes us trip over the cost threshold so I'm XFAILing the > > testcase for now. > > > > For BB vectorization all this doesn't work because we have no way > > to distinguish good from bad associations as we eventually build > > operands from scalars and thus not fail in the classical sense. > > > > Bootstrapped and tested on x86_64-unknown-linux-gnu, I'll re-do > > last years SPEC tests as well. Now that it is stage1 I'm considering > > to push this if there are no further comments given I plan to > > re-use some of the machinery for vectorization of BB reductions. > > Now finally pushed as ce670e4faafb296d1f1a7828d20f8c8ba4686797
Looks like this introduces an ICE on aarch64: spawn -ignore SIGHUP /data/ajc/toolchain/builds/rel/gcc/xgcc -B/data/ajc/toolchain/builds/rel/gcc/ /home/alecop01/toolchain/src/gcc/gcc/testsuite/gcc.dg/pr86179.c -fdiagnostics-plain-output -O3 -S -o pr86179.s during GIMPLE pass: vect /home/alecop01/toolchain/src/gcc/gcc/testsuite/gcc.dg/pr86179.c: In function 'c': /home/alecop01/toolchain/src/gcc/gcc/testsuite/gcc.dg/pr86179.c:7:6: internal compiler error: in vect_slp_analyze_node_operations, at tree-vect-slp.c:4444 0x1132edb vect_slp_analyze_node_operations /home/alecop01/toolchain/src/gcc/gcc/tree-vect-slp.c:4442 0x1132757 vect_slp_analyze_node_operations /home/alecop01/toolchain/src/gcc/gcc/tree-vect-slp.c:4385 0x1132757 vect_slp_analyze_node_operations /home/alecop01/toolchain/src/gcc/gcc/tree-vect-slp.c:4385 0x1132757 vect_slp_analyze_node_operations /home/alecop01/toolchain/src/gcc/gcc/tree-vect-slp.c:4385 0x1132757 vect_slp_analyze_node_operations /home/alecop01/toolchain/src/gcc/gcc/tree-vect-slp.c:4385 0x11355cf vect_slp_analyze_operations(vec_info*) /home/alecop01/toolchain/src/gcc/gcc/tree-vect-slp.c:4592 0x110cbe3 vect_analyze_loop_2 /home/alecop01/toolchain/src/gcc/gcc/tree-vect-loop.c:2396 0x110e4af vect_analyze_loop(loop*, vec_info_shared*) /home/alecop01/toolchain/src/gcc/gcc/tree-vect-loop.c:2986 0x114381b try_vectorize_loop_1 /home/alecop01/toolchain/src/gcc/gcc/tree-vectorizer.c:1009 0x11442d3 vectorize_loops() /home/alecop01/toolchain/src/gcc/gcc/tree-vectorizer.c:1243 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. compiler exited with status 1 FAIL: gcc.dg/pr86179.c (internal compiler error) Alex > > > Richard. > > > > 2021-05-31 Richard Biener <rguent...@suse.de> > > > > PR tree-optimization/97832 > > * tree-vectorizer.h (_slp_tree::failed): New. > > * tree-vect-slp.c (_slp_tree::_slp_tree): Initialize > > failed member. > > (_slp_tree::~_slp_tree): Free failed. > > (vect_build_slp_tree): Retain failed nodes and record > > matches in them, copying that back out when running > > into a cached fail. Dump start and end of discovery. > > (dt_sort_cmp): New. > > (vect_build_slp_tree_2): Handle associatable chains > > together doing more aggressive operand swapping. > > > > * gcc.dg/vect/pr97832-1.c: New testcase. > > * gcc.dg/vect/pr97832-2.c: Likewise. > > * gcc.dg/vect/pr97832-3.c: Likewise. > > * g++.dg/vect/slp-pr98855.cc: XFAIL. > > --- > > gcc/testsuite/g++.dg/vect/slp-pr98855.cc | 4 +- > > gcc/testsuite/gcc.dg/vect/pr97832-1.c | 17 + > > gcc/testsuite/gcc.dg/vect/pr97832-2.c | 29 ++ > > gcc/testsuite/gcc.dg/vect/pr97832-3.c | 50 +++ > > gcc/testsuite/gcc.dg/vect/slp-50.c | 20 + > > gcc/tree-vect-slp.c | 445 ++++++++++++++++++++++- > > gcc/tree-vectorizer.h | 5 + > > 7 files changed, 560 insertions(+), 10 deletions(-) > > create mode 100644 gcc/testsuite/gcc.dg/vect/pr97832-1.c > > create mode 100644 gcc/testsuite/gcc.dg/vect/pr97832-2.c > > create mode 100644 gcc/testsuite/gcc.dg/vect/pr97832-3.c > > create mode 100644 gcc/testsuite/gcc.dg/vect/slp-50.c