public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/redhat/heads/gcc-8-branch)] early-remat: Handle sets of multiple candidate regs [PR94605]
Date: Fri, 14 May 2021 14:54:20 +0000 (GMT)	[thread overview]
Message-ID: <20210514145420.6B1B9385482F@sourceware.org> (raw)

https://gcc.gnu.org/g:b335f2f04600d1bf76fe13675808cd4539f7b161

commit b335f2f04600d1bf76fe13675808cd4539f7b161
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Mon Apr 26 09:36:47 2021 +0100

    early-remat: Handle sets of multiple candidate regs [PR94605]
    
    early-remat.c:process_block wasn't handling insns that set multiple
    candidate registers, which led to an assertion failure at the end
    of the main loop.
    
    Instructions that set two pseudos aren't rematerialisation candidates in
    themselves, but we still need to track them if another instruction that
    sets the same register is a rematerialisation candidate.
    
    gcc/
            PR rtl-optimization/94605
            * early-remat.c (early_remat::process_block): Handle insns that
            set multiple candidate registers.
    
    gcc/testsuite/
            PR rtl-optimization/94605
            * gcc.target/aarch64/sve/pr94605.c: New test.
    
    (cherry picked from commit 3c3f12e2a7625c9a2f5d74a47dbacb2fd1ae5643)

Diff:
---
 gcc/early-remat.c                              |  2 +-
 gcc/testsuite/gcc.target/aarch64/sve/pr94605.c | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/gcc/early-remat.c b/gcc/early-remat.c
index 28eb9b4b2de..bba2c1a6db5 100644
--- a/gcc/early-remat.c
+++ b/gcc/early-remat.c
@@ -1995,7 +1995,7 @@ early_remat::process_block (basic_block bb)
 	}
 
       /* Now process definitions.  */
-      if (next_def && insn == next_def->insn)
+      while (next_def && insn == next_def->insn)
 	{
 	  unsigned int gen = canon_candidate (next_candidate);
 
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr94605.c b/gcc/testsuite/gcc.target/aarch64/sve/pr94605.c
new file mode 100644
index 00000000000..593e959e292
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr94605.c
@@ -0,0 +1,12 @@
+/* { dg-options "-O2 -msve-vector-bits=256" } */
+
+typedef int v8si __attribute__((vector_size(32)));
+int g (v8si, v8si);
+
+void
+f (void)
+{
+  v8si x = {}, y = {};
+  while (g (x, y))
+    asm ("" : "+w" (x), "+w" (y));
+}


                 reply	other threads:[~2021-05-14 14: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=20210514145420.6B1B9385482F@sourceware.org \
    --to=jakub@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).