aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-07-28 15:12:00 +0200
committerRichard Biener <rguenther@suse.de>2021-07-28 17:41:25 +0200
commit3c91efec15af4f922a9af495e178bbb66d2e9d1f (patch)
treedb19daa9c071ab3e79a8cb97e00e9d494b638879 /gcc
parent8b06ccb20eaf2e7cb85e9dca23f1599ee37d17a7 (diff)
downloadgcc-3c91efec15af4f922a9af495e178bbb66d2e9d1f.zip
gcc-3c91efec15af4f922a9af495e178bbb66d2e9d1f.tar.gz
gcc-3c91efec15af4f922a9af495e178bbb66d2e9d1f.tar.bz2
tree-optimization/101615 - SLP permute opt with CTOR roots
CTOR roots are not explicitely represented so we have to make sure to materialize permutes on SLP graph entries to them. 2021-07-28 Richard Biener <rguenther@suse.de> PR tree-optimization/101615 * tree-vect-slp.c (vect_optimize_slp): Materialize permutes at CTOR SLP graph entries. * gcc.dg/vect/bb-slp-pr101615-2.c: New testcase.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr101615-2.c23
-rw-r--r--gcc/tree-vect-slp.c12
2 files changed, 35 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr101615-2.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr101615-2.c
new file mode 100644
index 0000000..ac89883
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr101615-2.c
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+/* { dg-additional-options "-O3 -w -Wno-psabi" } */
+
+#include "tree-vect.h"
+
+int res[6] = { 5, 7, 11, 3, 3, 3 };
+int a[6] = {5, 5, 8};
+int c;
+
+int main()
+{
+ check_vect ();
+ for (int b = 0; b <= 4; b++)
+ for (; c <= 4; c++) {
+ a[0] |= 1;
+ for (int e = 0; e <= 4; e++)
+ a[e + 1] |= 3;
+ }
+ for (int d = 0; d < 6; d++)
+ if (a[d] != res[d])
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 07cc24a..a554c24 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -3715,6 +3715,18 @@ vect_optimize_slp (vec_info *vinfo)
vertices[idx].perm_out = perms.length () - 1;
}
+ /* In addition to the above we have to mark outgoing permutes facing
+ non-reduction graph entries that are not represented as to be
+ materialized. */
+ for (slp_instance instance : vinfo->slp_instances)
+ if (SLP_INSTANCE_KIND (instance) == slp_inst_kind_ctor)
+ {
+ /* Just setting perm_out isn't enough for the propagation to
+ pick this up. */
+ vertices[SLP_INSTANCE_TREE (instance)->vertex].perm_in = 0;
+ vertices[SLP_INSTANCE_TREE (instance)->vertex].perm_out = 0;
+ }
+
/* Propagate permutes along the graph and compute materialization points. */
bool changed;
bool do_materialization = false;