early-remat: Handle sets of multiple candidate regs [PR94605]
authorRichard Sandiford <richard.sandiford@arm.com>
Wed, 15 Apr 2020 10:38:24 +0000 (11:38 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 16 Apr 2020 12:06:10 +0000 (13:06 +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.

2020-04-16  Richard Sandiford  <richard.sandiford@arm.com>

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.

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

index 9f2f5db6f2f9284faf4a8e6ba74521a08105ac48..2901b2f3443b8e56c626e1b1cb79f09fe5a5a8cd 100644 (file)
@@ -1,3 +1,9 @@
+2020-04-16  Richard Sandiford  <richard.sandiford@arm.com>
+
+       PR rtl-optimization/94605
+       * early-remat.c (early_remat::process_block): Handle insns that
+       set multiple candidate registers.
+
 2020-04-16  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/94614
index 80672cca241092eb255fd3ceda529b162571a5c3..9f5f85416448b046c16ec59f9499da48576f11f1 100644 (file)
@@ -2020,7 +2020,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);
 
index f35d4e103715d4e94fdd9679ff358537523eac46..ed4420487fc0c6069a870e234e202b734378c4d8 100644 (file)
@@ -1,3 +1,8 @@
+2020-04-16  Richard Sandiford  <richard.sandiford@arm.com>
+
+       PR rtl-optimization/94605
+       * gcc.target/aarch64/sve/pr94605.c: New test.
+
 2020-04-16  Richard Biener  <rguenther@suse.de>
 
        * gcc.dg/graphite/interchange-1.c: Remove scan for tiled.
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));
+}