[llvm] update_test_checks: fix asimple regression (PR #111347)

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 01:17:52 PDT 2024


https://github.com/nhaehnle created https://github.com/llvm/llvm-project/pull/111347

Reported-by: Yingwei Zheng <dtcxzyw2333 at gmail.com>

>From c3e2aa894cb1ee23cd040a167c00f026747a3824 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= <nicolai.haehnle at amd.com>
Date: Mon, 7 Oct 2024 10:06:40 +0200
Subject: [PATCH 1/2] update_test_checks: pre-commit a test

---
 .../Inputs/stable_ir_values6.ll                  | 16 ++++++++++++++++
 .../Inputs/stable_ir_values6.ll.expected         | 16 ++++++++++++++++
 .../update_test_checks/stable_ir_values6.test    |  3 +++
 3 files changed, 35 insertions(+)
 create mode 100644 llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values6.ll
 create mode 100644 llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values6.ll.expected
 create mode 100644 llvm/test/tools/UpdateTestChecks/update_test_checks/stable_ir_values6.test

diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values6.ll b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values6.ll
new file mode 100644
index 00000000000000..dfdc9a75a78082
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values6.ll
@@ -0,0 +1,16 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt < %s -S | FileCheck %s
+
+; Test case where the same meta variable appears twice in a line
+
+define i8 @test(i8 %p) {
+; CHECK-LABEL: define i8 @test(
+; CHECK-SAME: i8 [[P:%.*]]) {
+; CHECK-NEXT:    [[Q:%.*]] = add i8 [[P]], 1
+; CHECK-NEXT:    [[X:%.*]] = mul i8 [[Q]], [[Q]]
+; CHECK-NEXT:    ret i8 [[X]]
+;
+  %r = sub i8 %p, 1
+  %x = mul i8 %r, %r
+  ret i8 %x
+}
diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values6.ll.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values6.ll.expected
new file mode 100644
index 00000000000000..a5ffe8d4f168db
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values6.ll.expected
@@ -0,0 +1,16 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt < %s -S | FileCheck %s
+
+; Test case where the same meta variable appears twice in a line
+
+define i8 @test(i8 %p) {
+; CHECK-LABEL: define i8 @test(
+; CHECK-SAME: i8 [[P:%.*]]) {
+; CHECK-NEXT:    [[Q:%.*]] = sub i8 [[P]], 1
+; CHECK-NEXT:    [[X:%.*]] = mul i8 [[Q]], [[Q]]
+; CHECK-NEXT:    ret i8 [[X]]
+;
+  %r = sub i8 %p, 1
+  %x = mul i8 %r, %r
+  ret i8 %x
+}
diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/stable_ir_values6.test b/llvm/test/tools/UpdateTestChecks/update_test_checks/stable_ir_values6.test
new file mode 100644
index 00000000000000..91883294f4c4a9
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/stable_ir_values6.test
@@ -0,0 +1,3 @@
+# RUN: cp -f %S/Inputs/stable_ir_values6.ll %t.ll && %update_test_checks %t.ll
+# RUN: diff -u %t.ll %S/Inputs/stable_ir_values6.ll.expected
+# XFAIL: *

>From 716f713d8c93684294ea2c7204a605113b93273e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= <nicolai.haehnle at amd.com>
Date: Mon, 7 Oct 2024 10:16:03 +0200
Subject: [PATCH 2/2] update_test_checks: fix a simple regression

Reported-by: Yingwei Zheng <dtcxzyw2333 at gmail.com>
---
 .../UpdateTestChecks/update_test_checks/stable_ir_values6.test  | 1 -
 llvm/utils/UpdateTestChecks/common.py                           | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/stable_ir_values6.test b/llvm/test/tools/UpdateTestChecks/update_test_checks/stable_ir_values6.test
index 91883294f4c4a9..90b41405592be3 100644
--- a/llvm/test/tools/UpdateTestChecks/update_test_checks/stable_ir_values6.test
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/stable_ir_values6.test
@@ -1,3 +1,2 @@
 # RUN: cp -f %S/Inputs/stable_ir_values6.ll %t.ll && %update_test_checks %t.ll
 # RUN: diff -u %t.ll %S/Inputs/stable_ir_values6.ll.expected
-# XFAIL: *
diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py
index 8ed600e5629e96..0fbb73431d2cfb 100644
--- a/llvm/utils/UpdateTestChecks/common.py
+++ b/llvm/utils/UpdateTestChecks/common.py
@@ -1603,7 +1603,7 @@ def __init__(self):
 
                 if rhs_value.name in new_color.mapping:
                     # Same, but for a possible commit happening on the same line
-                    if new_color.color[rhs_value.name] == lhs_value.name:
+                    if new_color.mapping[rhs_value.name] == lhs_value.name:
                         continue
                     else:
                         break



More information about the llvm-commits mailing list