[PATCH] D158397: [test] Add -verify-coalescing to testcase and fix problems with it

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 21 01:27:45 PDT 2023


uabelho created this revision.
uabelho added reviewers: bjope, arsenm, wmi, qcolombet, MatzeB, sdardis.
Herald added subscribers: atanasyan, jrtc27.
Herald added a project: All.
uabelho requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

Apparently the testcase
 coalesce-partial-redundant-reguse-terminator.mir
was broken in a way that -verify-coalescing detected.

Update the testcase so -verify-coalescing doesn't complain and so
that it still exposes the problem originally fixed in 6c062b7641623.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158397

Files:
  llvm/test/CodeGen/Mips/coalesce-partial-redundant-reguse-terminator.mir


Index: llvm/test/CodeGen/Mips/coalesce-partial-redundant-reguse-terminator.mir
===================================================================
--- llvm/test/CodeGen/Mips/coalesce-partial-redundant-reguse-terminator.mir
+++ llvm/test/CodeGen/Mips/coalesce-partial-redundant-reguse-terminator.mir
@@ -1,40 +1,35 @@
-# RUN: llc -march=mips64 -o - %s -run-pass=register-coalescer | FileCheck %s
+# RUN: llc -march=mips64 -o - %s -run-pass=register-coalescer -verify-coalescing | FileCheck %s
 
 ---
 name:            f
 tracksRegLiveness: true
 body:             |
  bb.0:
-    successors: %bb.1
-
-    %21:gpr32 = ADDiu $zero, 0
-    %22:gpr32 = COPY %21
-    %22:gpr32 = ADDiu %22, 1
+    %0:gpr32 = ADDiu $zero, 0
+    %1:gpr32 = COPY %0
+    %1:gpr32 = ADDiu %1, 1
+    BEQ %0, $zero, %bb.3, implicit-def $at
     J %bb.1, implicit-def dead $at
 
  bb.1:
-    successors: %bb.2
-
-    BEQ %22, $zero, %bb.2, implicit-def $at
+    J %bb.2, implicit %1, implicit-def dead $at
 
  bb.2:
-    successors: %bb.2, %bb.3
-
-    %22:gpr32 = COPY %21
-    %21:gpr32 = COPY %22
-    BEQ undef %0:gpr32, $zero, %bb.2, implicit-def $at
+    %1:gpr32 = COPY %0
+    %0:gpr32 = COPY %1
+    BEQ %0:gpr32, $zero, %bb.2, implicit-def $at
 
  bb.3:
-
+    %4:gpr32 = ADDiu %1, 1
 ...
 
 # We should not hoist the
 #
-#  %22:gpr32 = COPY %21
+#  %1:gpr32 = COPY %0
 #
-# into bb.1 since %22 is used in the BEQ.
+# into bb.1 since %1 is used in the terminating instruction J there.
 
-# CHECK-LABEL: bb.1:
+# CHECK-LABEL: bb.0:
 # CHECK-NOT:      COPY
 # CHECK:          BEQ
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158397.551927.patch
Type: text/x-patch
Size: 1562 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230821/cc7cc31b/attachment.bin>


More information about the llvm-commits mailing list