Skip to content

Commit 9f3f76a

Browse files
authored
update_test_checks: collect original check lines for old versions of lit tests (llvm#111148)
Old versions of UTC produced function labels like: ; CHECK-LABEL: @func( 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 <[email protected]>
1 parent bf488ed commit 9f3f76a

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values2.ll

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
22
; RUN: opt < %s -S | FileCheck %s
33

44
define i32 @func(i32 %x) {
5-
; CHECK-LABEL: define i32 @func(
6-
; CHECK-SAME: i32 [[X:%.*]]) {
7-
; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[X]], 0
5+
; CHECK-LABEL: @func(
6+
; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[X:.*]], 0
87
; CHECK-NEXT: [[TMP2:%.*]] = call i32 @foo(i1 [[TMP1]])
98
; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i32 [[X]], 1
109
; CHECK-NEXT: [[TMP4:%.*]] = call i32 @foo(i1 [[TMP3]])

llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values2.ll.expected

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
22
; RUN: opt < %s -S | FileCheck %s
33

44
define i32 @func(i32 %x) {
5-
; CHECK-LABEL: define i32 @func(
6-
; CHECK-SAME: i32 [[X:%.*]]) {
7-
; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[X]], 0
5+
; CHECK-LABEL: @func(
6+
; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[X:%.*]], 0
87
; CHECK-NEXT: [[TMP6:%.*]] = call i32 @foo(i1 [[TMP1]])
98
; CHECK-NEXT: [[TMP7:%.*]] = icmp eq i32 [[X]], 2
109
; CHECK-NEXT: [[TMP8:%.*]] = call i32 @foo(i1 [[TMP7]])

llvm/utils/UpdateTestChecks/common.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ def collect_original_check_lines(ti: TestInfo, prefix_set: set):
454454
continue
455455

456456
if check_kind == "LABEL":
457-
m = IR_FUNCTION_RE.match(line)
457+
m = IR_FUNCTION_LABEL_RE.match(line)
458458
if m is not None:
459459
func_name = m.group(1)
460460
if (
@@ -572,6 +572,9 @@ def invoke_tool(exe, cmd_args, ir, preprocess_cmd=None, verbose=False):
572572
)
573573

574574
IR_FUNCTION_RE = re.compile(r'^\s*define\s+(?:internal\s+)?[^@]*@"?([\w.$-]+)"?\s*\(')
575+
IR_FUNCTION_LABEL_RE = re.compile(
576+
r'^\s*(?:define\s+(?:internal\s+)?[^@]*)?@"?([\w.$-]+)"?\s*\('
577+
)
575578
TRIPLE_IR_RE = re.compile(r'^\s*target\s+triple\s*=\s*"([^"]+)"$')
576579
TRIPLE_ARG_RE = re.compile(r"-m?triple[= ]([^ ]+)")
577580
MARCH_ARG_RE = re.compile(r"-march[= ]([^ ]+)")

0 commit comments

Comments
 (0)