public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-9458] tree-optimization/101615 - SLP permute opt with CTOR roots
Date: Thu, 13 Jan 2022 10:54:10 +0000 (GMT)	[thread overview]
Message-ID: <20220113105410.4463C394AC22@sourceware.org> (raw)

https://gcc.gnu.org/g:7f49f50f756c06f4093358ff77c11152777fff1c

commit r11-9458-g7f49f50f756c06f4093358ff77c11152777fff1c
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Jul 28 15:12:00 2021 +0200

    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
            PR tree-optimization/103995
            * tree-vect-slp.c (vect_optimize_slp): Materialize permutes
            at CTOR SLP graph entries.
    
            * gcc.dg/vect/bb-slp-pr101615-2.c: New testcase.

Diff:
---
 gcc/testsuite/gcc.dg/vect/bb-slp-pr101615-2.c | 23 +++++++++++++++++++++++
 gcc/tree-vect-slp.c                           |  7 +++++++
 2 files changed, 30 insertions(+)

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 00000000000..ac89883de22
--- /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 3d4e701c0d8..230ff4081a5 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -3165,6 +3165,13 @@ vect_optimize_slp (vec_info *vinfo)
       n_perm[idx] = 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)
+      bitmap_set_bit (n_materialize, SLP_INSTANCE_TREE (instance)->vertex);
+
   /* Propagate permutes along the graph and compute materialization points.  */
   bool changed;
   unsigned iteration = 0;


                 reply	other threads:[~2022-01-13 10:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220113105410.4463C394AC22@sourceware.org \
    --to=rguenth@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).