Skip to content

[UTC] Recognise CHECK lines with globals matched literally #70050

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

Merged
merged 2 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; RUN: opt -S < %s | FileCheck %s

@G = constant i32 42

;.
; CHECK: @G = constant i32 42
;.
define ptr @foo() {
; CHECK-LABEL: @foo(
; CHECK-NEXT: ret ptr @G
;
ret ptr @G
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: -p --check-globals
; RUN: opt -S < %s | FileCheck %s

@G = constant i32 42

;.
; CHECK: @G = constant i32 42
;.
define ptr @foo() {
; CHECK-LABEL: @foo(
; CHECK-NEXT: ret ptr @G
;
ret ptr @G
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Basic test checking that we capture existing lines matching global variable names
# RUN: cp -f %S/Inputs/global_preserve_name.ll %t.ll && %update_test_checks %t.ll --check-globals --preserve-names
# RUN: diff -u %t.ll %S/Inputs/global_preserve_name.ll.expected
## Verify that running without the --global-value-regex flag respects UTC_ARGS, and that the output is a fixed point.
# RUN: %update_test_checks %t.ll
# RUN: diff -u %t.ll %S/Inputs/global_preserve_name.ll.expected

2 changes: 1 addition & 1 deletion llvm/utils/UpdateTestChecks/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def should_add_line_to_output(
m = CHECK_RE.match(input_line)
if m and m.group(1) in prefix_set:
if skip_global_checks:
global_ir_value_re = re.compile(r"\[\[", flags=(re.M))
global_ir_value_re = re.compile(r"(\[\[|@)", flags=(re.M))
return not global_ir_value_re.search(input_line)
return False

Expand Down