Skip to content

Commit 4f083c0

Browse files
committed
[DebugInfo] Make tests SimplifyCFG-independent (NFC)
Run SimplifyCFG over the test input and disable the SimplifyCFG run in the backend, so that these tests are not affected by changes to SimplifyCFG.
1 parent ea28668 commit 4f083c0

File tree

2 files changed

+89
-100
lines changed

2 files changed

+89
-100
lines changed

llvm/test/DebugInfo/COFF/AArch64/arm64-register-variables.ll

Lines changed: 36 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc < %s -mtriple=arm64-windows -filetype=obj | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ
1+
; RUN: llc < %s -mtriple=arm64-windows -filetype=obj -aarch64-enable-atomic-cfg-tidy=0 | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ
22

33
; Generated from:
44
; volatile int x;
@@ -41,56 +41,50 @@ target triple = "arm64-unknown-windows-msvc19.16.27023"
4141

4242
@x = common dso_local global i32 0, align 4, !dbg !0
4343

44-
; Function Attrs: noinline nounwind optnone uwtable
45-
define dso_local void @f(i32 %p) #0 !dbg !12 {
44+
define dso_local void @f(i32 %p) !dbg !11 {
4645
entry:
4746
%p.addr = alloca i32, align 4
4847
%a = alloca i32, align 4
4948
%b = alloca i32, align 4
5049
%c = alloca i32, align 4
5150
store i32 %p, ptr %p.addr, align 4
52-
call void @llvm.dbg.declare(metadata ptr %p.addr, metadata !15, metadata !DIExpression()), !dbg !16
53-
%0 = load i32, ptr %p.addr, align 4, !dbg !17
54-
%tobool = icmp ne i32 %0, 0, !dbg !17
55-
br i1 %tobool, label %if.then, label %if.else, !dbg !17
51+
#dbg_declare(ptr %p.addr, !14, !DIExpression(), !15)
52+
%0 = load i32, ptr %p.addr, align 4, !dbg !16
53+
%tobool = icmp ne i32 %0, 0, !dbg !16
54+
%call = call i32 @getint(), !dbg !17
55+
br i1 %tobool, label %if.then, label %if.else, !dbg !16
5656

5757
if.then: ; preds = %entry
58-
call void @llvm.dbg.declare(metadata ptr %a, metadata !18, metadata !DIExpression()), !dbg !21
59-
%call = call i32 @getint(), !dbg !21
58+
#dbg_declare(ptr %a, !19, !DIExpression(), !21)
6059
store i32 %call, ptr %a, align 4, !dbg !21
61-
call void @llvm.dbg.declare(metadata ptr %b, metadata !22, metadata !DIExpression()), !dbg !23
60+
#dbg_declare(ptr %b, !22, !DIExpression(), !23)
6261
%1 = load i32, ptr %a, align 4, !dbg !23
6362
%call1 = call i32 @inlineinc(i32 %1), !dbg !23
6463
store i32 %call1, ptr %b, align 4, !dbg !23
6564
%2 = load i32, ptr %b, align 4, !dbg !24
66-
call void @putint(i32 %2), !dbg !24
6765
br label %if.end, !dbg !25
6866

6967
if.else: ; preds = %entry
70-
call void @llvm.dbg.declare(metadata ptr %c, metadata !26, metadata !DIExpression()), !dbg !28
71-
%call2 = call i32 @getint(), !dbg !28
72-
store i32 %call2, ptr %c, align 4, !dbg !28
68+
#dbg_declare(ptr %c, !26, !DIExpression(), !28)
69+
store i32 %call, ptr %c, align 4, !dbg !28
7370
%3 = load i32, ptr %c, align 4, !dbg !29
74-
call void @putint(i32 %3), !dbg !29
7571
br label %if.end, !dbg !30
7672

7773
if.end: ; preds = %if.else, %if.then
74+
%.sink = phi i32 [ %3, %if.else ], [ %2, %if.then ]
75+
call void @putint(i32 %.sink), !dbg !17
7876
ret void, !dbg !31
7977
}
8078

81-
; Function Attrs: nounwind readnone speculatable
82-
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
79+
declare dso_local i32 @getint()
8380

84-
declare dso_local i32 @getint() #2
85-
86-
; Function Attrs: noinline nounwind optnone uwtable
87-
define internal i32 @inlineinc(i32 %a) #0 !dbg !32 {
81+
define internal i32 @inlineinc(i32 %a) !dbg !32 {
8882
entry:
8983
%a.addr = alloca i32, align 4
9084
%b = alloca i32, align 4
9185
store i32 %a, ptr %a.addr, align 4
92-
call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !35, metadata !DIExpression()), !dbg !36
93-
call void @llvm.dbg.declare(metadata ptr %b, metadata !37, metadata !DIExpression()), !dbg !38
86+
#dbg_declare(ptr %a.addr, !35, !DIExpression(), !36)
87+
#dbg_declare(ptr %b, !37, !DIExpression(), !38)
9488
%0 = load i32, ptr %a.addr, align 4, !dbg !38
9589
%add = add nsw i32 %0, 1, !dbg !38
9690
store i32 %add, ptr %b, align 4, !dbg !38
@@ -101,43 +95,43 @@ entry:
10195
ret i32 %2, !dbg !40
10296
}
10397

104-
declare dso_local void @putint(i32) #2
98+
declare dso_local void @putint(i32)
10599

106100
!llvm.dbg.cu = !{!2}
107101
!llvm.module.flags = !{!8, !9, !10}
108102

109103
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
110104
!1 = distinct !DIGlobalVariable(name: "x", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
111105
!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 9.0.0 (trunk 361867) (llvm/trunk 361866)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)
112-
!3 = !DIFile(filename: "t.c", directory: "S:\5CLLVM\5Csvn\5Csbr\5Cbin", checksumkind: CSK_MD5, checksum: "734c448e95a6204a439a847ed063e5ce")
106+
!3 = !DIFile(filename: "t.c", directory: "S:\\LLVM\\svn\\sbr\\bin", checksumkind: CSK_MD5, checksum: "734c448e95a6204a439a847ed063e5ce")
113107
!4 = !{}
114108
!5 = !{!0}
115109
!6 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7)
116110
!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
117111
!8 = !{i32 2, !"CodeView", i32 1}
118112
!9 = !{i32 2, !"Debug Info Version", i32 3}
119113
!10 = !{i32 1, !"wchar_size", i32 2}
120-
!11 = !{!"clang version 9.0.0 (trunk 361867) (llvm/trunk 361866)"}
121-
!12 = distinct !DISubprogram(name: "f", scope: !3, file: !3, line: 9, type: !13, scopeLine: 9, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4)
122-
!13 = !DISubroutineType(types: !14)
123-
!14 = !{null, !7}
124-
!15 = !DILocalVariable(name: "p", arg: 1, scope: !12, file: !3, line: 9, type: !7)
125-
!16 = !DILocation(line: 9, scope: !12)
126-
!17 = !DILocation(line: 10, scope: !12)
127-
!18 = !DILocalVariable(name: "a", scope: !19, file: !3, line: 11, type: !7)
128-
!19 = distinct !DILexicalBlock(scope: !20, file: !3, line: 10)
129-
!20 = distinct !DILexicalBlock(scope: !12, file: !3, line: 10)
130-
!21 = !DILocation(line: 11, scope: !19)
131-
!22 = !DILocalVariable(name: "b", scope: !19, file: !3, line: 12, type: !7)
132-
!23 = !DILocation(line: 12, scope: !19)
133-
!24 = !DILocation(line: 13, scope: !19)
134-
!25 = !DILocation(line: 14, scope: !19)
114+
!11 = distinct !DISubprogram(name: "f", scope: !3, file: !3, line: 9, type: !12, scopeLine: 9, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4)
115+
!12 = !DISubroutineType(types: !13)
116+
!13 = !{null, !7}
117+
!14 = !DILocalVariable(name: "p", arg: 1, scope: !11, file: !3, line: 9, type: !7)
118+
!15 = !DILocation(line: 9, scope: !11)
119+
!16 = !DILocation(line: 10, scope: !11)
120+
!17 = !DILocation(line: 0, scope: !18)
121+
!18 = distinct !DILexicalBlock(scope: !11, file: !3, line: 10)
122+
!19 = !DILocalVariable(name: "a", scope: !20, file: !3, line: 11, type: !7)
123+
!20 = distinct !DILexicalBlock(scope: !18, file: !3, line: 10)
124+
!21 = !DILocation(line: 11, scope: !20)
125+
!22 = !DILocalVariable(name: "b", scope: !20, file: !3, line: 12, type: !7)
126+
!23 = !DILocation(line: 12, scope: !20)
127+
!24 = !DILocation(line: 13, scope: !20)
128+
!25 = !DILocation(line: 14, scope: !20)
135129
!26 = !DILocalVariable(name: "c", scope: !27, file: !3, line: 15, type: !7)
136-
!27 = distinct !DILexicalBlock(scope: !20, file: !3, line: 14)
130+
!27 = distinct !DILexicalBlock(scope: !18, file: !3, line: 14)
137131
!28 = !DILocation(line: 15, scope: !27)
138132
!29 = !DILocation(line: 16, scope: !27)
139133
!30 = !DILocation(line: 17, scope: !27)
140-
!31 = !DILocation(line: 18, scope: !12)
134+
!31 = !DILocation(line: 18, scope: !11)
141135
!32 = distinct !DISubprogram(name: "inlineinc", scope: !3, file: !3, line: 4, type: !33, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !2, retainedNodes: !4)
142136
!33 = !DISubroutineType(types: !34)
143137
!34 = !{!7, !7}

llvm/test/DebugInfo/COFF/ARMNT/arm-register-variables.ll

Lines changed: 53 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc < %s -filetype=obj | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ
1+
; RUN: llc < %s -filetype=obj -arm-atomic-cfg-tidy=0 | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ
22

33
; Generated from:
44

@@ -57,64 +57,58 @@ target triple = "thumbv7-pc-windows-msvc19.11.0"
5757

5858
@x = dso_local global i32 0, align 4, !dbg !0
5959

60-
; Function Attrs: noinline nounwind optnone
6160
define dso_local arm_aapcs_vfpcc void @f(i32 %p) !dbg !14 {
6261
entry:
6362
%p.addr = alloca i32, align 4
6463
%a = alloca i32, align 4
6564
%b = alloca i32, align 4
6665
%c = alloca i32, align 4
6766
store i32 %p, ptr %p.addr, align 4
68-
call void @llvm.dbg.declare(metadata ptr %p.addr, metadata !17, metadata !DIExpression()), !dbg !18
67+
#dbg_declare(ptr %p.addr, !17, !DIExpression(), !18)
6968
%0 = load i32, ptr %p.addr, align 4, !dbg !19
7069
%tobool = icmp ne i32 %0, 0, !dbg !19
70+
%call = call arm_aapcs_vfpcc i32 @getint(), !dbg !20
7171
br i1 %tobool, label %if.then, label %if.else, !dbg !19
7272

7373
if.then: ; preds = %entry
74-
call void @llvm.dbg.declare(metadata ptr %a, metadata !20, metadata !DIExpression()), !dbg !23
75-
%call = call arm_aapcs_vfpcc i32 @getint(), !dbg !23
76-
store i32 %call, ptr %a, align 4, !dbg !23
77-
call void @llvm.dbg.declare(metadata ptr %b, metadata !24, metadata !DIExpression()), !dbg !25
78-
%1 = load i32, ptr %a, align 4, !dbg !25
79-
%call1 = call arm_aapcs_vfpcc i32 @inlineinc(i32 %1), !dbg !25
80-
store i32 %call1, ptr %b, align 4, !dbg !25
81-
%2 = load i32, ptr %b, align 4, !dbg !26
82-
call arm_aapcs_vfpcc void @putint(i32 %2), !dbg !26
83-
br label %if.end, !dbg !27
74+
#dbg_declare(ptr %a, !22, !DIExpression(), !24)
75+
store i32 %call, ptr %a, align 4, !dbg !24
76+
#dbg_declare(ptr %b, !25, !DIExpression(), !26)
77+
%1 = load i32, ptr %a, align 4, !dbg !26
78+
%call1 = call arm_aapcs_vfpcc i32 @inlineinc(i32 %1), !dbg !26
79+
store i32 %call1, ptr %b, align 4, !dbg !26
80+
%2 = load i32, ptr %b, align 4, !dbg !27
81+
br label %if.end, !dbg !28
8482

8583
if.else: ; preds = %entry
86-
call void @llvm.dbg.declare(metadata ptr %c, metadata !28, metadata !DIExpression()), !dbg !30
87-
%call2 = call arm_aapcs_vfpcc i32 @getint(), !dbg !30
88-
store i32 %call2, ptr %c, align 4, !dbg !30
89-
%3 = load i32, ptr %c, align 4, !dbg !31
90-
call arm_aapcs_vfpcc void @putint(i32 %3), !dbg !31
91-
br label %if.end, !dbg !32
84+
#dbg_declare(ptr %c, !29, !DIExpression(), !31)
85+
store i32 %call, ptr %c, align 4, !dbg !31
86+
%3 = load i32, ptr %c, align 4, !dbg !32
87+
br label %if.end, !dbg !33
9288

9389
if.end: ; preds = %if.else, %if.then
94-
ret void, !dbg !33
90+
%.sink = phi i32 [ %3, %if.else ], [ %2, %if.then ]
91+
call arm_aapcs_vfpcc void @putint(i32 %.sink), !dbg !20
92+
ret void, !dbg !34
9593
}
9694

97-
; Function Attrs: nounwind readnone speculatable willreturn
98-
declare void @llvm.dbg.declare(metadata, metadata, metadata)
99-
10095
declare dso_local arm_aapcs_vfpcc i32 @getint()
10196

102-
; Function Attrs: noinline nounwind optnone
103-
define internal arm_aapcs_vfpcc i32 @inlineinc(i32 %a) !dbg !34 {
97+
define internal arm_aapcs_vfpcc i32 @inlineinc(i32 %a) !dbg !35 {
10498
entry:
10599
%a.addr = alloca i32, align 4
106100
%b = alloca i32, align 4
107101
store i32 %a, ptr %a.addr, align 4
108-
call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !37, metadata !DIExpression()), !dbg !38
109-
call void @llvm.dbg.declare(metadata ptr %b, metadata !39, metadata !DIExpression()), !dbg !40
110-
%0 = load i32, ptr %a.addr, align 4, !dbg !40
111-
%add = add nsw i32 %0, 1, !dbg !40
112-
store i32 %add, ptr %b, align 4, !dbg !40
113-
%1 = load volatile i32, ptr @x, align 4, !dbg !41
114-
%inc = add nsw i32 %1, 1, !dbg !41
115-
store volatile i32 %inc, ptr @x, align 4, !dbg !41
116-
%2 = load i32, ptr %b, align 4, !dbg !42
117-
ret i32 %2, !dbg !42
102+
#dbg_declare(ptr %a.addr, !38, !DIExpression(), !39)
103+
#dbg_declare(ptr %b, !40, !DIExpression(), !41)
104+
%0 = load i32, ptr %a.addr, align 4, !dbg !41
105+
%add = add nsw i32 %0, 1, !dbg !41
106+
store i32 %add, ptr %b, align 4, !dbg !41
107+
%1 = load volatile i32, ptr @x, align 4, !dbg !42
108+
%inc = add nsw i32 %1, 1, !dbg !42
109+
store volatile i32 %inc, ptr @x, align 4, !dbg !42
110+
%2 = load i32, ptr %b, align 4, !dbg !43
111+
ret i32 %2, !dbg !43
118112
}
119113

120114
declare dso_local arm_aapcs_vfpcc void @putint(i32)
@@ -143,26 +137,27 @@ declare dso_local arm_aapcs_vfpcc void @putint(i32)
143137
!17 = !DILocalVariable(name: "p", arg: 1, scope: !14, file: !6, line: 9, type: !8)
144138
!18 = !DILocation(line: 9, scope: !14)
145139
!19 = !DILocation(line: 10, scope: !14)
146-
!20 = !DILocalVariable(name: "a", scope: !21, file: !6, line: 11, type: !8)
147-
!21 = distinct !DILexicalBlock(scope: !22, file: !6, line: 10)
148-
!22 = distinct !DILexicalBlock(scope: !14, file: !6, line: 10)
149-
!23 = !DILocation(line: 11, scope: !21)
150-
!24 = !DILocalVariable(name: "b", scope: !21, file: !6, line: 12, type: !8)
151-
!25 = !DILocation(line: 12, scope: !21)
152-
!26 = !DILocation(line: 13, scope: !21)
153-
!27 = !DILocation(line: 14, scope: !21)
154-
!28 = !DILocalVariable(name: "c", scope: !29, file: !6, line: 15, type: !8)
155-
!29 = distinct !DILexicalBlock(scope: !22, file: !6, line: 14)
156-
!30 = !DILocation(line: 15, scope: !29)
157-
!31 = !DILocation(line: 16, scope: !29)
158-
!32 = !DILocation(line: 17, scope: !29)
159-
!33 = !DILocation(line: 18, scope: !14)
160-
!34 = distinct !DISubprogram(name: "inlineinc", scope: !6, file: !6, line: 4, type: !35, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !2, retainedNodes: !4)
161-
!35 = !DISubroutineType(types: !36)
162-
!36 = !{!8, !8}
163-
!37 = !DILocalVariable(name: "a", arg: 1, scope: !34, file: !6, line: 4, type: !8)
164-
!38 = !DILocation(line: 4, scope: !34)
165-
!39 = !DILocalVariable(name: "b", scope: !34, file: !6, line: 5, type: !8)
166-
!40 = !DILocation(line: 5, scope: !34)
167-
!41 = !DILocation(line: 6, scope: !34)
168-
!42 = !DILocation(line: 7, scope: !34)
140+
!20 = !DILocation(line: 0, scope: !21)
141+
!21 = distinct !DILexicalBlock(scope: !14, file: !6, line: 10)
142+
!22 = !DILocalVariable(name: "a", scope: !23, file: !6, line: 11, type: !8)
143+
!23 = distinct !DILexicalBlock(scope: !21, file: !6, line: 10)
144+
!24 = !DILocation(line: 11, scope: !23)
145+
!25 = !DILocalVariable(name: "b", scope: !23, file: !6, line: 12, type: !8)
146+
!26 = !DILocation(line: 12, scope: !23)
147+
!27 = !DILocation(line: 13, scope: !23)
148+
!28 = !DILocation(line: 14, scope: !23)
149+
!29 = !DILocalVariable(name: "c", scope: !30, file: !6, line: 15, type: !8)
150+
!30 = distinct !DILexicalBlock(scope: !21, file: !6, line: 14)
151+
!31 = !DILocation(line: 15, scope: !30)
152+
!32 = !DILocation(line: 16, scope: !30)
153+
!33 = !DILocation(line: 17, scope: !30)
154+
!34 = !DILocation(line: 18, scope: !14)
155+
!35 = distinct !DISubprogram(name: "inlineinc", scope: !6, file: !6, line: 4, type: !36, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !2, retainedNodes: !4)
156+
!36 = !DISubroutineType(types: !37)
157+
!37 = !{!8, !8}
158+
!38 = !DILocalVariable(name: "a", arg: 1, scope: !35, file: !6, line: 4, type: !8)
159+
!39 = !DILocation(line: 4, scope: !35)
160+
!40 = !DILocalVariable(name: "b", scope: !35, file: !6, line: 5, type: !8)
161+
!41 = !DILocation(line: 5, scope: !35)
162+
!42 = !DILocation(line: 6, scope: !35)
163+
!43 = !DILocation(line: 7, scope: !35)

0 commit comments

Comments
 (0)