]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
early-remat: Handle sets of multiple candidate regs [PR94605]
authorRichard Sandiford <richard.sandiford@arm.com>
Fri, 7 Aug 2020 09:39:39 +0000 (10:39 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Fri, 7 Aug 2020 09:39:39 +0000 (10:39 +0100)
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)

gcc/early-remat.c
gcc/testsuite/gcc.target/aarch64/sve/pr94605.c [new file with mode: 0644]

index 122891c1edb5ac775be8a98646c813cd1aeb5b18..712e39033f4ef8d1748b2a326ddde1b068c8c560 100644 (file)
@@ -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 (file)
index 0000000..593e959
--- /dev/null
@@ -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));
+}