aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.h
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-11-18 14:17:34 +0100
committerRichard Biener <rguenther@suse.de>2021-06-09 14:41:42 +0200
commitce670e4faafb296d1f1a7828d20f8c8ba4686797 (patch)
tree32e1806d019c44ba59b0fef020ccd2c661ce69d0 /gcc/tree-vectorizer.h
parent13a39886940331149173b25d6ebde0850668d8b9 (diff)
downloadgcc-ce670e4faafb296d1f1a7828d20f8c8ba4686797.zip
gcc-ce670e4faafb296d1f1a7828d20f8c8ba4686797.tar.gz
gcc-ce670e4faafb296d1f1a7828d20f8c8ba4686797.tar.bz2
tree-optimization/97832 - handle associatable chains in SLP discovery
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. 2021-05-31 Richard Biener <rguenther@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.
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r--gcc/tree-vectorizer.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 06d20c7..1fb46c6 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -167,6 +167,11 @@ struct _slp_tree {
int vertex;
+ /* If not NULL this is a cached failed SLP discovery attempt with
+ the lanes that failed during SLP discovery as 'false'. This is
+ a copy of the matches array. */
+ bool *failed;
+
/* Allocate from slp_tree_pool. */
static void *operator new (size_t);