[llvm] [update_mir_test_checks] Precommit test for multiple defs of vreg (PR #66483)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 15 02:48:18 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-testing-tools
<details>
<summary>Changes</summary>
XFAIL it until it is fixed by an upcoming commit.
--
Full diff: https://github.com/llvm/llvm-project/pull/66483.diff
3 Files Affected:
- (added) llvm/test/tools/UpdateTestChecks/update_mir_test_checks/Inputs/multiple-defs.mir (+12)
- (added) llvm/test/tools/UpdateTestChecks/update_mir_test_checks/multiple-defs.test (+5)
- (modified) llvm/utils/update_mir_test_checks.py (+5-2)
<pre>
diff --git a/llvm/test/tools/UpdateTestChecks/update_mir_test_checks/Inputs/multiple-defs.mir b/llvm/test/tools/UpdateTestChecks/update_mir_test_checks/Inputs/multiple-defs.mir
new file mode 100644
index 000000000000000..ff12ed7770beca0
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_mir_test_checks/Inputs/multiple-defs.mir
@@ -0,0 +1,12 @@
+# RUN: llc -mtriple=x86_64 -run-pass=none -verify-machineinstrs %s -o - | FileCheck %s
+
+---
+name: test
+body: |
+ bb.0:
+ %0:gr32 = IMPLICIT_DEF
+ %1:gr32 = IMPLICIT_DEF
+ %0:gr32 = IMPLICIT_DEF
+ %2:gr32 = IMPLICIT_DEF
+ KILL %0, %2
+...
diff --git a/llvm/test/tools/UpdateTestChecks/update_mir_test_checks/multiple-defs.test b/llvm/test/tools/UpdateTestChecks/update_mir_test_checks/multiple-defs.test
new file mode 100644
index 000000000000000..1009bcd7571159c
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_mir_test_checks/multiple-defs.test
@@ -0,0 +1,5 @@
+## Check that update_mir_test_checks handles multiple definitions of the same
+## virtual register (after coming out of SSA form).
+
+# RUN: cp -f %S/Inputs/multiple-defs.mir %t.mir && %update_mir_test_checks %t.mir
+# RUN: FileCheck %t.mir < %t.mir
diff --git a/llvm/utils/update_mir_test_checks.py b/llvm/utils/update_mir_test_checks.py
index 815738b23402310..8a539b5fb5ce4bc 100755
--- a/llvm/utils/update_mir_test_checks.py
+++ b/llvm/utils/update_mir_test_checks.py
@@ -204,8 +204,11 @@ def build_function_info_dictionary(
m = VREG_DEF_RE.match(func_line)
if m:
for vreg in VREG_RE.finditer(m.group("vregs")):
- name = mangle_vreg(m.group("opcode"), vreg_map.values())
- vreg_map[vreg.group(1)] = name
+ if vreg.group(1) in vreg_map:
+ name = vreg_map[vreg.group(1)]
+ else:
+ name = mangle_vreg(m.group("opcode"), vreg_map.values())
+ vreg_map[vreg.group(1)] = name
func_line = func_line.replace(
vreg.group(1), "[[{}:%[0-9]+]]".format(name), 1
)
</pre>
</details>
https://github.com/llvm/llvm-project/pull/66483
More information about the llvm-commits
mailing list