-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update_test_checks: collect original check lines for old versions of lit tests #111148
Conversation
…lit tests Old versions of UTC produced function labels like: ; CHECK-LABEL: @func( Fix the regular expression used when scanning for old check lines to recognizes this form of label. This allows meta variable stability to apply when running UTC on tests using this form of label. Reported-by: Nikita Popov <npopov@redhat.com>
@llvm/pr-subscribers-testing-tools Author: Nicolai Hähnle (nhaehnle) ChangesOld versions of UTC produced function labels like:
Fix the regular expression used when scanning for old check lines to recognizes this form of label. This allows meta variable stability to apply when running UTC on tests using this form of label. Reported-by: Nikita Popov <npopov@redhat.com> Full diff: https://github.com/llvm/llvm-project/pull/111148.diff 3 Files Affected:
diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values2.ll b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values2.ll
index d05c26241f87c1..c6ccaa4f450762 100644
--- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values2.ll
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values2.ll
@@ -1,10 +1,9 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S | FileCheck %s
define i32 @func(i32 %x) {
-; CHECK-LABEL: define i32 @func(
-; CHECK-SAME: i32 [[X:%.*]]) {
-; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[X]], 0
+; CHECK-LABEL: @func(
+; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[X:.*]], 0
; CHECK-NEXT: [[TMP2:%.*]] = call i32 @foo(i1 [[TMP1]])
; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i32 [[X]], 1
; CHECK-NEXT: [[TMP4:%.*]] = call i32 @foo(i1 [[TMP3]])
diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values2.ll.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values2.ll.expected
index 6311a55a1f9de1..d5d2eb71ac5656 100644
--- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values2.ll.expected
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values2.ll.expected
@@ -1,10 +1,9 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S | FileCheck %s
define i32 @func(i32 %x) {
-; CHECK-LABEL: define i32 @func(
-; CHECK-SAME: i32 [[X:%.*]]) {
-; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[X]], 0
+; CHECK-LABEL: @func(
+; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[X:%.*]], 0
; CHECK-NEXT: [[TMP6:%.*]] = call i32 @foo(i1 [[TMP1]])
; CHECK-NEXT: [[TMP7:%.*]] = icmp eq i32 [[X]], 2
; CHECK-NEXT: [[TMP8:%.*]] = call i32 @foo(i1 [[TMP7]])
diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py
index 759fc5d7a43aa2..8ed600e5629e96 100644
--- a/llvm/utils/UpdateTestChecks/common.py
+++ b/llvm/utils/UpdateTestChecks/common.py
@@ -454,7 +454,7 @@ def collect_original_check_lines(ti: TestInfo, prefix_set: set):
continue
if check_kind == "LABEL":
- m = IR_FUNCTION_RE.match(line)
+ m = IR_FUNCTION_LABEL_RE.match(line)
if m is not None:
func_name = m.group(1)
if (
@@ -572,6 +572,9 @@ def invoke_tool(exe, cmd_args, ir, preprocess_cmd=None, verbose=False):
)
IR_FUNCTION_RE = re.compile(r'^\s*define\s+(?:internal\s+)?[^@]*@"?([\w.$-]+)"?\s*\(')
+IR_FUNCTION_LABEL_RE = re.compile(
+ r'^\s*(?:define\s+(?:internal\s+)?[^@]*)?@"?([\w.$-]+)"?\s*\('
+)
TRIPLE_IR_RE = re.compile(r'^\s*target\s+triple\s*=\s*"([^"]+)"$')
TRIPLE_ARG_RE = re.compile(r"-m?triple[= ]([^ ]+)")
MARCH_ARG_RE = re.compile(r"-march[= ]([^ ]+)")
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Tried regenerating all InstCombine tests again, and now only 44 files change, and it looks like for all of these the changes are not due to instruction naming, but other formatting changes. So this seems to work perfectly now! |
Old versions of UTC produced function labels like:
Fix the regular expression used when scanning for old check lines to recognize this form of label.
This allows meta variable stability to apply when running UTC on tests using this form of label.
Reported-by: Nikita Popov npopov@redhat.com