[llvm] 47b9884 - update_mir_test_checks.py: match dead vreg definitions

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 11:42:01 PST 2022


Author: Nicolai Hähnle
Date: 2022-12-08T20:41:24+01:00
New Revision: 47b988403d15233eb405b9f7db7d6c6c428bb5dc

URL: https://github.com/llvm/llvm-project/commit/47b988403d15233eb405b9f7db7d6c6c428bb5dc
DIFF: https://github.com/llvm/llvm-project/commit/47b988403d15233eb405b9f7db7d6c6c428bb5dc.diff

LOG: update_mir_test_checks.py: match dead vreg definitions

Differential Revision: https://reviews.llvm.org/D139466

Added: 
    llvm/test/tools/UpdateTestChecks/update_mir_test_checks/Inputs/x86-dead-def.mir
    llvm/test/tools/UpdateTestChecks/update_mir_test_checks/Inputs/x86-dead-def.mir.expected
    llvm/test/tools/UpdateTestChecks/update_mir_test_checks/x86-dead-def.test

Modified: 
    llvm/utils/update_mir_test_checks.py

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/UpdateTestChecks/update_mir_test_checks/Inputs/x86-dead-def.mir b/llvm/test/tools/UpdateTestChecks/update_mir_test_checks/Inputs/x86-dead-def.mir
new file mode 100644
index 000000000000..b6695624da48
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_mir_test_checks/Inputs/x86-dead-def.mir
@@ -0,0 +1,20 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: llc -mtriple=x86_64-linux-gnu -run-pass=none -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes=CHECK
+
+--- |
+
+  define void @test() {
+    unreachable
+  }
+
+...
+---
+name:            test
+alignment:       16
+registers:
+  - { id: 0, class: gpr, preferred-register: '' }
+body:             |
+  bb.1:
+    dead %0(s32) = G_CONSTANT i32 0
+
+...

diff  --git a/llvm/test/tools/UpdateTestChecks/update_mir_test_checks/Inputs/x86-dead-def.mir.expected b/llvm/test/tools/UpdateTestChecks/update_mir_test_checks/Inputs/x86-dead-def.mir.expected
new file mode 100644
index 000000000000..f8b01e63a94a
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_mir_test_checks/Inputs/x86-dead-def.mir.expected
@@ -0,0 +1,22 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: llc -mtriple=x86_64-linux-gnu -run-pass=none -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes=CHECK
+
+--- |
+
+  define void @test() {
+    unreachable
+  }
+
+...
+---
+name:            test
+alignment:       16
+registers:
+  - { id: 0, class: gpr, preferred-register: '' }
+body:             |
+  bb.1:
+    ; CHECK-LABEL: name: test
+    ; CHECK: dead [[C:%[0-9]+]]:gpr(s32) = G_CONSTANT i32 0
+    dead %0(s32) = G_CONSTANT i32 0
+
+...

diff  --git a/llvm/test/tools/UpdateTestChecks/update_mir_test_checks/x86-dead-def.test b/llvm/test/tools/UpdateTestChecks/update_mir_test_checks/x86-dead-def.test
new file mode 100644
index 000000000000..3fb19a711fdb
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_mir_test_checks/x86-dead-def.test
@@ -0,0 +1,5 @@
+# REQUIRES: x86-registered-target
+## Check that update_mir_test_checks replaces vregs in dead definitions
+
+# RUN: cp -f %S/Inputs/x86-dead-def.mir %t.mir && %update_mir_test_checks %t.mir
+# RUN: 
diff  -u %S/Inputs/x86-dead-def.mir.expected %t.mir

diff  --git a/llvm/utils/update_mir_test_checks.py b/llvm/utils/update_mir_test_checks.py
index 5fb811023922..4d275b6870d6 100755
--- a/llvm/utils/update_mir_test_checks.py
+++ b/llvm/utils/update_mir_test_checks.py
@@ -36,9 +36,11 @@
 MI_FLAGS_STR= (
     r'(frame-setup |frame-destroy |nnan |ninf |nsz |arcp |contract |afn '
     r'|reassoc |nuw |nsw |exact |nofpexcept |nomerge )*')
+VREG_DEF_FLAGS_STR = r'(?:dead )*'
 VREG_DEF_RE = re.compile(
-    r'^ *(?P<vregs>{0}(?:, {0})*) = '
-    r'{1}(?P<opcode>[A-Zt][A-Za-z0-9_]+)'.format(VREG_RE.pattern, MI_FLAGS_STR))
+    r'^ *(?P<vregs>{2}{0}(?:, {2}{0})*) = '
+    r'{1}(?P<opcode>[A-Zt][A-Za-z0-9_]+)'.format(
+        VREG_RE.pattern, MI_FLAGS_STR, VREG_DEF_FLAGS_STR))
 MIR_PREFIX_DATA_RE = re.compile(r'^ *(;|bb.[0-9].*: *$|[a-z]+:( |$)|$)')
 
 IR_FUNC_NAME_RE = re.compile(


        


More information about the llvm-commits mailing list