Skip to content

Commit 35787e3

Browse files
Tom WeaverTom Weaver
Tom Weaver
authored and
Tom Weaver
committed
[DBG][LIVEDEBUGVALUES][NFC] Add Targeted LiveDebugValues Behaviour Tests.
Adds 22 distinct tests that exercise the live-debug-values passes expected behaviour. reviewers: aprantl, vsk Differential revision: https://reviews.llvm.org/D72515
1 parent 25a8aec commit 35787e3

22 files changed

+1546
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
--- |
2+
; RUN: llc %s -run-pass=livedebugvalues -o - | FileCheck %s -implicit-check-not=DBG_VALUE
3+
4+
; Check that DBG_VALUE instructions are propogated through a CFG containing
5+
; a diamond that doesn't move or clobber their locations.
6+
7+
; CHECK-LABEL: bb.0.entry:
8+
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
9+
; CHECK-LABEL: bb.1.bb1:
10+
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
11+
; CHECK-LABEL: bb.2.bb2:
12+
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
13+
; CHECK-LABEL: bb.3.bb3:
14+
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
15+
16+
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
17+
entry:
18+
br label %bb1, !dbg !17
19+
bb1:
20+
br label %bb2, !dbg !17
21+
bb2:
22+
br label %bb3, !dbg !17
23+
bb3:
24+
ret i32 0, !dbg !17
25+
}
26+
27+
!llvm.dbg.cu = !{!0}
28+
!llvm.module.flags = !{!7, !8, !9, !10}
29+
!llvm.ident = !{!11}
30+
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !3, debugInfoForProfiling: true, nameTableKind: None)
31+
!1 = !DIFile(filename: "main.cpp", directory: "F:\")
32+
!2 = !{}
33+
!3 = !{!4}
34+
!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
35+
!5 = distinct !DIGlobalVariable(name: "start", scope: !0, file: !1, line: 4, type: !6, isLocal: false, isDefinition: true)
36+
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
37+
!7 = !{i32 2, !"Dwarf Version", i32 4}
38+
!8 = !{i32 2, !"Debug Info Version", i32 3}
39+
!9 = !{i32 1, !"wchar_size", i32 2}
40+
!10 = !{i32 7, !"PIC Level", i32 2}
41+
!11 = !{!"clang version 10.0.0"}
42+
!12 = distinct !DISubprogram(name: "bb_to_bb", linkageName: "bb_to_bb", scope: !1, file: !1, line: 6, type: !13, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)
43+
!13 = !DISubroutineType(types: !14)
44+
!14 = !{!6, !6}
45+
!15 = !{!16}
46+
!16 = !DILocalVariable(name: "myVar", scope: !12, file: !1, line: 7, type: !6)
47+
!17 = !DILocation(line: 10, scope: !12)
48+
49+
...
50+
---
51+
name: _Z8bb_to_bb
52+
body: |
53+
bb.0.entry:
54+
successors: %bb.1, %bb.2
55+
$ebx = MOV32ri 0, debug-location !17
56+
DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
57+
JCC_1 %bb.2, 4, implicit killed $eflags
58+
bb.1.bb1:
59+
successors: %bb.3
60+
$eax = MOV32ri 0, debug-location !17
61+
JMP_1 %bb.3
62+
bb.2.bb2:
63+
successors: %bb.3
64+
$eax = MOV32ri 0, debug-location !17
65+
bb.3.bb3:
66+
RETQ $eax, debug-location !17
67+
...
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
--- |
2+
; RUN: llc %s -run-pass=livedebugvalues -o - | FileCheck %s -implicit-check-not=DBG_VALUE
3+
4+
; Check that DBG_VALUE instructions are only propogated into the top blocks of
5+
; a diamond when the location is clobbered and not into the successor block.
6+
7+
; CHECK-LABEL: bb.0.entry:
8+
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
9+
; CHECK-LABEL: bb.1.bb1:
10+
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
11+
; CHECK-NEXT: $ebx = MOV32ri 0, debug-location !17
12+
; CHECK-LABEL: bb.2.bb2:
13+
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
14+
; CHECK-NEXT: $ebx = MOV32ri 0, debug-location !17
15+
16+
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
17+
entry:
18+
br label %bb1, !dbg !17
19+
bb1:
20+
br label %bb2, !dbg !17
21+
bb2:
22+
br label %bb3, !dbg !17
23+
bb3:
24+
ret i32 0, !dbg !17
25+
}
26+
27+
!llvm.dbg.cu = !{!0}
28+
!llvm.module.flags = !{!7, !8, !9, !10}
29+
!llvm.ident = !{!11}
30+
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !3, debugInfoForProfiling: true, nameTableKind: None)
31+
!1 = !DIFile(filename: "main.cpp", directory: "F:\")
32+
!2 = !{}
33+
!3 = !{!4}
34+
!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
35+
!5 = distinct !DIGlobalVariable(name: "start", scope: !0, file: !1, line: 4, type: !6, isLocal: false, isDefinition: true)
36+
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
37+
!7 = !{i32 2, !"Dwarf Version", i32 4}
38+
!8 = !{i32 2, !"Debug Info Version", i32 3}
39+
!9 = !{i32 1, !"wchar_size", i32 2}
40+
!10 = !{i32 7, !"PIC Level", i32 2}
41+
!11 = !{!"clang version 10.0.0"}
42+
!12 = distinct !DISubprogram(name: "bb_to_bb", linkageName: "bb_to_bb", scope: !1, file: !1, line: 6, type: !13, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)
43+
!13 = !DISubroutineType(types: !14)
44+
!14 = !{!6, !6}
45+
!15 = !{!16}
46+
!16 = !DILocalVariable(name: "myVar", scope: !12, file: !1, line: 7, type: !6)
47+
!17 = !DILocation(line: 10, scope: !12)
48+
49+
...
50+
---
51+
name: _Z8bb_to_bb
52+
body: |
53+
bb.0.entry:
54+
successors: %bb.1, %bb.2
55+
$ebx = MOV32ri 0, debug-location !17
56+
DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
57+
JCC_1 %bb.2, 4, implicit killed $eflags
58+
bb.1.bb1:
59+
successors: %bb.3
60+
$ebx = MOV32ri 0, debug-location !17
61+
JMP_1 %bb.3
62+
bb.2.bb2:
63+
successors: %bb.3
64+
$ebx = MOV32ri 0, debug-location !17
65+
bb.3.bb3:
66+
RETQ $eax, debug-location !17
67+
...
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
--- |
2+
; RUN: llc %s -run-pass=livedebugvalues -o - | FileCheck %s -implicit-check-not=DBG_VALUE
3+
4+
; Check that DBG_VALUE instructions are propogated correctly through a
5+
; diamond CFG when the location is moved by another instruction.
6+
7+
; CHECK-LABEL: bb.0.entry:
8+
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
9+
; CHECK-LABEL: bb.1.bb1:
10+
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
11+
; CHECK-NEXT: $eax = MOV32ri 0, debug-location !17
12+
; CHECK-NEXT: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
13+
; CHECK-LABEL: bb.2.bb2:
14+
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
15+
; CHECK-NEXT: $eax = MOV32ri 0, debug-location !17
16+
; CHECK-NEXT: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
17+
; CHECK-LABEL: bb.3.bb3:
18+
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
19+
20+
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
21+
entry:
22+
br label %bb1, !dbg !17
23+
bb1:
24+
br label %bb2, !dbg !17
25+
bb2:
26+
br label %bb3, !dbg !17
27+
bb3:
28+
ret i32 0, !dbg !17
29+
}
30+
31+
!llvm.dbg.cu = !{!0}
32+
!llvm.module.flags = !{!7, !8, !9, !10}
33+
!llvm.ident = !{!11}
34+
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !3, debugInfoForProfiling: true, nameTableKind: None)
35+
!1 = !DIFile(filename: "main.cpp", directory: "F:\")
36+
!2 = !{}
37+
!3 = !{!4}
38+
!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
39+
!5 = distinct !DIGlobalVariable(name: "start", scope: !0, file: !1, line: 4, type: !6, isLocal: false, isDefinition: true)
40+
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
41+
!7 = !{i32 2, !"Dwarf Version", i32 4}
42+
!8 = !{i32 2, !"Debug Info Version", i32 3}
43+
!9 = !{i32 1, !"wchar_size", i32 2}
44+
!10 = !{i32 7, !"PIC Level", i32 2}
45+
!11 = !{!"clang version 10.0.0"}
46+
!12 = distinct !DISubprogram(name: "bb_to_bb", linkageName: "bb_to_bb", scope: !1, file: !1, line: 6, type: !13, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)
47+
!13 = !DISubroutineType(types: !14)
48+
!14 = !{!6, !6}
49+
!15 = !{!16}
50+
!16 = !DILocalVariable(name: "myVar", scope: !12, file: !1, line: 7, type: !6)
51+
!17 = !DILocation(line: 10, scope: !12)
52+
53+
...
54+
---
55+
name: _Z8bb_to_bb
56+
body: |
57+
bb.0.entry:
58+
successors: %bb.1, %bb.2
59+
$ebx = MOV32ri 0, debug-location !17
60+
DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
61+
JCC_1 %bb.2, 4, implicit killed $eflags
62+
bb.1.bb1:
63+
successors: %bb.3
64+
$eax = MOV32ri 0, debug-location !17
65+
DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
66+
JMP_1 %bb.3
67+
bb.2.bb2:
68+
successors: %bb.3
69+
$eax = MOV32ri 0, debug-location !17
70+
DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
71+
bb.3.bb3:
72+
RETQ $eax, debug-location !17
73+
...
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
--- |
2+
; RUN: llc %s -run-pass=livedebugvalues -o - | FileCheck %s -implicit-check-not=DBG_VALUE
3+
4+
; Check that DBG_VALUE instructions are not propagated into a successor block
5+
; of a diamond CFG that clobbers its location.
6+
7+
; CHECK-LABEL: bb.0.entry:
8+
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
9+
; CHECK-LABEL: bb.1.bb1:
10+
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
11+
; CHECK-LABEL: bb.2.bb2:
12+
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
13+
14+
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
15+
entry:
16+
br label %bb1, !dbg !17
17+
bb1:
18+
br label %bb2, !dbg !17
19+
bb2:
20+
br label %bb3, !dbg !17
21+
bb3:
22+
ret i32 0, !dbg !17
23+
}
24+
25+
!llvm.dbg.cu = !{!0}
26+
!llvm.module.flags = !{!7, !8, !9, !10}
27+
!llvm.ident = !{!11}
28+
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !3, debugInfoForProfiling: true, nameTableKind: None)
29+
!1 = !DIFile(filename: "main.cpp", directory: "F:\")
30+
!2 = !{}
31+
!3 = !{!4}
32+
!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
33+
!5 = distinct !DIGlobalVariable(name: "start", scope: !0, file: !1, line: 4, type: !6, isLocal: false, isDefinition: true)
34+
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
35+
!7 = !{i32 2, !"Dwarf Version", i32 4}
36+
!8 = !{i32 2, !"Debug Info Version", i32 3}
37+
!9 = !{i32 1, !"wchar_size", i32 2}
38+
!10 = !{i32 7, !"PIC Level", i32 2}
39+
!11 = !{!"clang version 10.0.0"}
40+
!12 = distinct !DISubprogram(name: "bb_to_bb", linkageName: "bb_to_bb", scope: !1, file: !1, line: 6, type: !13, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)
41+
!13 = !DISubroutineType(types: !14)
42+
!14 = !{!6, !6}
43+
!15 = !{!16}
44+
!16 = !DILocalVariable(name: "myVar", scope: !12, file: !1, line: 7, type: !6)
45+
!17 = !DILocation(line: 10, scope: !12)
46+
47+
...
48+
---
49+
name: _Z8bb_to_bb
50+
body: |
51+
bb.0.entry:
52+
successors: %bb.1, %bb.2
53+
$ebx = MOV32ri 0, debug-location !17
54+
DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
55+
JCC_1 %bb.2, 4, implicit killed $eflags
56+
bb.1.bb1:
57+
successors: %bb.3
58+
$ebx = MOV32ri 0, debug-location !17
59+
JMP_1 %bb.3
60+
bb.2.bb2:
61+
successors: %bb.3
62+
$eax = MOV32ri 0, debug-location !17
63+
bb.3.bb3:
64+
RETQ $eax, debug-location !17
65+
...
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
--- |
2+
; RUN: llc %s -run-pass=livedebugvalues -o - | FileCheck %s -implicit-check-not=DBG_VALUE
3+
4+
; Check that DBG_VALUE instructions are not propagated into a successor block
5+
; of a diamond CFG that moves its location.
6+
7+
; CHECK-LABEL: bb.0.entry:
8+
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
9+
; CHECK-LABEL: bb.1.bb1:
10+
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
11+
; CHECK-NEXT: $eax = MOV32ri 0, debug-location !17
12+
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
13+
; CHECK-LABEL: bb.2.bb2:
14+
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
15+
16+
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
17+
entry:
18+
br label %bb1, !dbg !17
19+
bb1:
20+
br label %bb2, !dbg !17
21+
bb2:
22+
br label %bb3, !dbg !17
23+
bb3:
24+
ret i32 0, !dbg !17
25+
}
26+
27+
!llvm.dbg.cu = !{!0}
28+
!llvm.module.flags = !{!7, !8, !9, !10}
29+
!llvm.ident = !{!11}
30+
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !3, debugInfoForProfiling: true, nameTableKind: None)
31+
!1 = !DIFile(filename: "main.cpp", directory: "F:\")
32+
!2 = !{}
33+
!3 = !{!4}
34+
!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
35+
!5 = distinct !DIGlobalVariable(name: "start", scope: !0, file: !1, line: 4, type: !6, isLocal: false, isDefinition: true)
36+
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
37+
!7 = !{i32 2, !"Dwarf Version", i32 4}
38+
!8 = !{i32 2, !"Debug Info Version", i32 3}
39+
!9 = !{i32 1, !"wchar_size", i32 2}
40+
!10 = !{i32 7, !"PIC Level", i32 2}
41+
!11 = !{!"clang version 10.0.0"}
42+
!12 = distinct !DISubprogram(name: "bb_to_bb", linkageName: "bb_to_bb", scope: !1, file: !1, line: 6, type: !13, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)
43+
!13 = !DISubroutineType(types: !14)
44+
!14 = !{!6, !6}
45+
!15 = !{!16}
46+
!16 = !DILocalVariable(name: "myVar", scope: !12, file: !1, line: 7, type: !6)
47+
!17 = !DILocation(line: 10, scope: !12)
48+
49+
...
50+
---
51+
name: _Z8bb_to_bb
52+
body: |
53+
bb.0.entry:
54+
successors: %bb.1, %bb.2
55+
$ebx = MOV32ri 0, debug-location !17
56+
DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
57+
JCC_1 %bb.2, 4, implicit killed $eflags
58+
bb.1.bb1:
59+
successors: %bb.3
60+
$eax = MOV32ri 0, debug-location !17
61+
DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
62+
JMP_1 %bb.3
63+
bb.2.bb2:
64+
successors: %bb.3
65+
$eax = MOV32ri 0, debug-location !17
66+
bb.3.bb3:
67+
RETQ $eax, debug-location !17
68+
...

0 commit comments

Comments
 (0)