Skip to content

update_test_checks: indent dbg records #139230

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 3 commits into from
May 9, 2025
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
Expand Up @@ -47,11 +47,11 @@ define dso_local void @foo(ptr %A) #0 !dbg !7 {
entry:
%A.addr = alloca ptr, align 8, !DIAssignID !16
%i = alloca i32, align 4
#dbg_assign(i1 undef, !13, !DIExpression(), !16, ptr %A.addr, !DIExpression(), !17)
#dbg_assign(i1 undef, !13, !DIExpression(), !16, ptr %A.addr, !DIExpression(), !17)
store ptr %A, ptr %A.addr, align 8, !tbaa !18
#dbg_declare(ptr %A.addr, !13, !DIExpression(), !17)
#dbg_declare(ptr %A.addr, !13, !DIExpression(), !17)
call void @llvm.lifetime.start.p0(i64 4, ptr %i) #2, !dbg !22
#dbg_declare(ptr %i, !14, !DIExpression(), !23)
#dbg_declare(ptr %i, !14, !DIExpression(), !23)
store i32 0, ptr %i, align 4, !dbg !23, !tbaa !24
br label %for.cond, !dbg !22

Expand Down Expand Up @@ -130,9 +130,9 @@ entry:
%A.addr = alloca ptr, align 8
%i = alloca i32, align 4
store ptr %A, ptr %A.addr, align 8, !tbaa !18
#dbg_declare(ptr %A.addr, !43, !DIExpression(), !46)
#dbg_declare(ptr %A.addr, !43, !DIExpression(), !46)
call void @llvm.lifetime.start.p0(i64 4, ptr %i) #2, !dbg !47
#dbg_declare(ptr %i, !44, !DIExpression(), !48)
#dbg_declare(ptr %i, !44, !DIExpression(), !48)
store i32 0, ptr %i, align 4, !dbg !48, !tbaa !24
br label %for.cond, !dbg !47

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ define dso_local void @foo(ptr %A) #0 !dbg !7 {
entry:
%A.addr = alloca ptr, align 8, !DIAssignID !16
%i = alloca i32, align 4
#dbg_assign(i1 undef, !13, !DIExpression(), !16, ptr %A.addr, !DIExpression(), !17)
#dbg_assign(i1 undef, !13, !DIExpression(), !16, ptr %A.addr, !DIExpression(), !17)
store ptr %A, ptr %A.addr, align 8, !tbaa !18
#dbg_declare(ptr %A.addr, !13, !DIExpression(), !17)
#dbg_declare(ptr %A.addr, !13, !DIExpression(), !17)
call void @llvm.lifetime.start.p0(i64 4, ptr %i) #2, !dbg !22
#dbg_declare(ptr %i, !14, !DIExpression(), !23)
#dbg_declare(ptr %i, !14, !DIExpression(), !23)
store i32 0, ptr %i, align 4, !dbg !23, !tbaa !24
br label %for.cond, !dbg !22

Expand Down Expand Up @@ -132,9 +132,9 @@ entry:
%A.addr = alloca ptr, align 8
%i = alloca i32, align 4
store ptr %A, ptr %A.addr, align 8, !tbaa !18
#dbg_declare(ptr %A.addr, !43, !DIExpression(), !46)
#dbg_declare(ptr %A.addr, !43, !DIExpression(), !46)
call void @llvm.lifetime.start.p0(i64 4, ptr %i) #2, !dbg !47
#dbg_declare(ptr %i, !44, !DIExpression(), !48)
#dbg_declare(ptr %i, !44, !DIExpression(), !48)
store i32 0, ptr %i, align 4, !dbg !48, !tbaa !24
br label %for.cond, !dbg !47

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ define dso_local void @foo(ptr %A) #0 !dbg !7 {
entry:
%A.addr = alloca ptr, align 8, !DIAssignID !16
%i = alloca i32, align 4
#dbg_assign(i1 undef, !13, !DIExpression(), !16, ptr %A.addr, !DIExpression(), !17)
#dbg_assign(i1 undef, !13, !DIExpression(), !16, ptr %A.addr, !DIExpression(), !17)
store ptr %A, ptr %A.addr, align 8, !tbaa !18
#dbg_declare(ptr %A.addr, !13, !DIExpression(), !17)
#dbg_declare(ptr %A.addr, !13, !DIExpression(), !17)
call void @llvm.lifetime.start.p0(i64 4, ptr %i) #2, !dbg !22
#dbg_declare(ptr %i, !14, !DIExpression(), !23)
#dbg_declare(ptr %i, !14, !DIExpression(), !23)
store i32 0, ptr %i, align 4, !dbg !23, !tbaa !24
br label %for.cond, !dbg !22

Expand Down Expand Up @@ -132,9 +132,9 @@ entry:
%A.addr = alloca ptr, align 8
%i = alloca i32, align 4
store ptr %A, ptr %A.addr, align 8, !tbaa !18
#dbg_declare(ptr %A.addr, !43, !DIExpression(), !46)
#dbg_declare(ptr %A.addr, !43, !DIExpression(), !46)
call void @llvm.lifetime.start.p0(i64 4, ptr %i) #2, !dbg !47
#dbg_declare(ptr %i, !44, !DIExpression(), !48)
#dbg_declare(ptr %i, !44, !DIExpression(), !48)
store i32 0, ptr %i, align 4, !dbg !48, !tbaa !24
br label %for.cond, !dbg !47

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ define dso_local void @foo(ptr %A) #0 !dbg !7 {
entry:
%A.addr = alloca ptr, align 8, !DIAssignID !16
%i = alloca i32, align 4
#dbg_assign(i1 undef, !13, !DIExpression(), !16, ptr %A.addr, !DIExpression(), !17)
#dbg_assign(i1 undef, !13, !DIExpression(), !16, ptr %A.addr, !DIExpression(), !17)
store ptr %A, ptr %A.addr, align 8, !tbaa !18
#dbg_declare(ptr %A.addr, !13, !DIExpression(), !17)
#dbg_declare(ptr %A.addr, !13, !DIExpression(), !17)
call void @llvm.lifetime.start.p0(i64 4, ptr %i) #2, !dbg !22
#dbg_declare(ptr %i, !14, !DIExpression(), !23)
#dbg_declare(ptr %i, !14, !DIExpression(), !23)
store i32 0, ptr %i, align 4, !dbg !23, !tbaa !24
br label %for.cond, !dbg !22

Expand Down Expand Up @@ -130,9 +130,9 @@ entry:
%A.addr = alloca ptr, align 8
%i = alloca i32, align 4
store ptr %A, ptr %A.addr, align 8, !tbaa !18
#dbg_declare(ptr %A.addr, !43, !DIExpression(), !46)
#dbg_declare(ptr %A.addr, !43, !DIExpression(), !46)
call void @llvm.lifetime.start.p0(i64 4, ptr %i) #2, !dbg !47
#dbg_declare(ptr %i, !44, !DIExpression(), !48)
#dbg_declare(ptr %i, !44, !DIExpression(), !48)
store i32 0, ptr %i, align 4, !dbg !48, !tbaa !24
br label %for.cond, !dbg !47

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ define dso_local void @foo(ptr %A) #0 !dbg !7 {
entry:
%A.addr = alloca ptr, align 8, !DIAssignID !16
%i = alloca i32, align 4
#dbg_assign(i1 undef, !13, !DIExpression(), !16, ptr %A.addr, !DIExpression(), !17)
#dbg_assign(i1 undef, !13, !DIExpression(), !16, ptr %A.addr, !DIExpression(), !17)
store ptr %A, ptr %A.addr, align 8, !tbaa !18
#dbg_declare(ptr %A.addr, !13, !DIExpression(), !17)
#dbg_declare(ptr %A.addr, !13, !DIExpression(), !17)
call void @llvm.lifetime.start.p0(i64 4, ptr %i) #2, !dbg !22
#dbg_declare(ptr %i, !14, !DIExpression(), !23)
#dbg_declare(ptr %i, !14, !DIExpression(), !23)
store i32 0, ptr %i, align 4, !dbg !23, !tbaa !24
br label %for.cond, !dbg !22

Expand Down Expand Up @@ -130,9 +130,9 @@ entry:
%A.addr = alloca ptr, align 8
%i = alloca i32, align 4
store ptr %A, ptr %A.addr, align 8, !tbaa !18
#dbg_declare(ptr %A.addr, !43, !DIExpression(), !46)
#dbg_declare(ptr %A.addr, !43, !DIExpression(), !46)
call void @llvm.lifetime.start.p0(i64 4, ptr %i) #2, !dbg !47
#dbg_declare(ptr %i, !44, !DIExpression(), !48)
#dbg_declare(ptr %i, !44, !DIExpression(), !48)
store i32 0, ptr %i, align 4, !dbg !48, !tbaa !24
br label %for.cond, !dbg !47

Expand Down
2 changes: 2 additions & 0 deletions llvm/utils/UpdateTestChecks/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,8 @@ def invoke_tool(exe, cmd_args, ir, preprocess_cmd=None, verbose=False):
MARCH_ARG_RE = re.compile(r"-march[= ]([^ ]+)")
DEBUG_ONLY_ARG_RE = re.compile(r"-debug-only[= ]([^ ]+)")

IS_DEBUG_RECORD_RE = re.compile(r"^(\s+)#dbg_")

SCRUB_LEADING_WHITESPACE_RE = re.compile(r"^(\s+)")
SCRUB_WHITESPACE_RE = re.compile(r"(?!^(| \w))[ \t]+", flags=re.M)
SCRUB_PRESERVE_LEADING_WHITESPACE_RE = re.compile(r"((?!^)[ \t]*(\S))[ \t]+")
Expand Down
7 changes: 5 additions & 2 deletions llvm/utils/update_test_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,11 @@ def update_test(ti: common.TestInfo):
skip_same_checks=dropped_previous_line,
):
# This input line of the function body will go as-is into the output.
# Except make leading whitespace uniform: 2 spaces.
input_line = common.SCRUB_LEADING_WHITESPACE_RE.sub(r" ", input_line)
# Except make leading whitespace uniform: 2 spaces. 4 for debug records.
indent = (
" " if not common.IS_DEBUG_RECORD_RE.match(input_line) else " "
)
input_line = common.SCRUB_LEADING_WHITESPACE_RE.sub(indent, input_line)
output_lines.append(input_line)
dropped_previous_line = False
if input_line.strip() == "}":
Expand Down
Loading