Skip to content

Commit

Permalink
[DBG][LIVEDEBUGVALUES][NFC] Add Targeted LiveDebugValues Behaviour Te…
Browse files Browse the repository at this point in the history
…sts.

Adds 22 distinct tests that exercise the live-debug-values passes
expected behaviour.

reviewers: aprantl, vsk

Differential revision: https://reviews.llvm.org/D72515
  • Loading branch information
Tom Weaver authored and Tom Weaver committed Jan 14, 2020
1 parent 25a8aec commit 35787e3
Show file tree
Hide file tree
Showing 22 changed files with 1,546 additions and 0 deletions.
67 changes: 67 additions & 0 deletions llvm/test/DebugInfo/MIR/X86/livedebugvalues_basic_diamond.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
--- |
; RUN: llc %s -run-pass=livedebugvalues -o - | FileCheck %s -implicit-check-not=DBG_VALUE

; Check that DBG_VALUE instructions are propogated through a CFG containing
; a diamond that doesn't move or clobber their locations.

; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-LABEL: bb.3.bb3:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17

define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:
br label %bb1, !dbg !17
bb1:
br label %bb2, !dbg !17
bb2:
br label %bb3, !dbg !17
bb3:
ret i32 0, !dbg !17
}

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!7, !8, !9, !10}
!llvm.ident = !{!11}
!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)
!1 = !DIFile(filename: "main.cpp", directory: "F:\")
!2 = !{}
!3 = !{!4}
!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
!5 = distinct !DIGlobalVariable(name: "start", scope: !0, file: !1, line: 4, type: !6, isLocal: false, isDefinition: true)
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!7 = !{i32 2, !"Dwarf Version", i32 4}
!8 = !{i32 2, !"Debug Info Version", i32 3}
!9 = !{i32 1, !"wchar_size", i32 2}
!10 = !{i32 7, !"PIC Level", i32 2}
!11 = !{!"clang version 10.0.0"}
!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)
!13 = !DISubroutineType(types: !14)
!14 = !{!6, !6}
!15 = !{!16}
!16 = !DILocalVariable(name: "myVar", scope: !12, file: !1, line: 7, type: !6)
!17 = !DILocation(line: 10, scope: !12)

...
---
name: _Z8bb_to_bb
body: |
bb.0.entry:
successors: %bb.1, %bb.2
$ebx = MOV32ri 0, debug-location !17
DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
JCC_1 %bb.2, 4, implicit killed $eflags
bb.1.bb1:
successors: %bb.3
$eax = MOV32ri 0, debug-location !17
JMP_1 %bb.3
bb.2.bb2:
successors: %bb.3
$eax = MOV32ri 0, debug-location !17
bb.3.bb3:
RETQ $eax, debug-location !17
...
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
--- |
; RUN: llc %s -run-pass=livedebugvalues -o - | FileCheck %s -implicit-check-not=DBG_VALUE

; Check that DBG_VALUE instructions are only propogated into the top blocks of
; a diamond when the location is clobbered and not into the successor block.

; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-NEXT: $ebx = MOV32ri 0, debug-location !17
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-NEXT: $ebx = MOV32ri 0, debug-location !17

define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:
br label %bb1, !dbg !17
bb1:
br label %bb2, !dbg !17
bb2:
br label %bb3, !dbg !17
bb3:
ret i32 0, !dbg !17
}

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!7, !8, !9, !10}
!llvm.ident = !{!11}
!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)
!1 = !DIFile(filename: "main.cpp", directory: "F:\")
!2 = !{}
!3 = !{!4}
!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
!5 = distinct !DIGlobalVariable(name: "start", scope: !0, file: !1, line: 4, type: !6, isLocal: false, isDefinition: true)
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!7 = !{i32 2, !"Dwarf Version", i32 4}
!8 = !{i32 2, !"Debug Info Version", i32 3}
!9 = !{i32 1, !"wchar_size", i32 2}
!10 = !{i32 7, !"PIC Level", i32 2}
!11 = !{!"clang version 10.0.0"}
!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)
!13 = !DISubroutineType(types: !14)
!14 = !{!6, !6}
!15 = !{!16}
!16 = !DILocalVariable(name: "myVar", scope: !12, file: !1, line: 7, type: !6)
!17 = !DILocation(line: 10, scope: !12)

...
---
name: _Z8bb_to_bb
body: |
bb.0.entry:
successors: %bb.1, %bb.2
$ebx = MOV32ri 0, debug-location !17
DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
JCC_1 %bb.2, 4, implicit killed $eflags
bb.1.bb1:
successors: %bb.3
$ebx = MOV32ri 0, debug-location !17
JMP_1 %bb.3
bb.2.bb2:
successors: %bb.3
$ebx = MOV32ri 0, debug-location !17
bb.3.bb3:
RETQ $eax, debug-location !17
...
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
--- |
; RUN: llc %s -run-pass=livedebugvalues -o - | FileCheck %s -implicit-check-not=DBG_VALUE

; Check that DBG_VALUE instructions are propogated correctly through a
; diamond CFG when the location is moved by another instruction.

; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-NEXT: $eax = MOV32ri 0, debug-location !17
; CHECK-NEXT: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-NEXT: $eax = MOV32ri 0, debug-location !17
; CHECK-NEXT: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-LABEL: bb.3.bb3:
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17

define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:
br label %bb1, !dbg !17
bb1:
br label %bb2, !dbg !17
bb2:
br label %bb3, !dbg !17
bb3:
ret i32 0, !dbg !17
}

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!7, !8, !9, !10}
!llvm.ident = !{!11}
!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)
!1 = !DIFile(filename: "main.cpp", directory: "F:\")
!2 = !{}
!3 = !{!4}
!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
!5 = distinct !DIGlobalVariable(name: "start", scope: !0, file: !1, line: 4, type: !6, isLocal: false, isDefinition: true)
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!7 = !{i32 2, !"Dwarf Version", i32 4}
!8 = !{i32 2, !"Debug Info Version", i32 3}
!9 = !{i32 1, !"wchar_size", i32 2}
!10 = !{i32 7, !"PIC Level", i32 2}
!11 = !{!"clang version 10.0.0"}
!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)
!13 = !DISubroutineType(types: !14)
!14 = !{!6, !6}
!15 = !{!16}
!16 = !DILocalVariable(name: "myVar", scope: !12, file: !1, line: 7, type: !6)
!17 = !DILocation(line: 10, scope: !12)

...
---
name: _Z8bb_to_bb
body: |
bb.0.entry:
successors: %bb.1, %bb.2
$ebx = MOV32ri 0, debug-location !17
DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
JCC_1 %bb.2, 4, implicit killed $eflags
bb.1.bb1:
successors: %bb.3
$eax = MOV32ri 0, debug-location !17
DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
JMP_1 %bb.3
bb.2.bb2:
successors: %bb.3
$eax = MOV32ri 0, debug-location !17
DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
bb.3.bb3:
RETQ $eax, debug-location !17
...
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
--- |
; RUN: llc %s -run-pass=livedebugvalues -o - | FileCheck %s -implicit-check-not=DBG_VALUE

; Check that DBG_VALUE instructions are not propagated into a successor block
; of a diamond CFG that clobbers its location.

; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17

define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:
br label %bb1, !dbg !17
bb1:
br label %bb2, !dbg !17
bb2:
br label %bb3, !dbg !17
bb3:
ret i32 0, !dbg !17
}

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!7, !8, !9, !10}
!llvm.ident = !{!11}
!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)
!1 = !DIFile(filename: "main.cpp", directory: "F:\")
!2 = !{}
!3 = !{!4}
!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
!5 = distinct !DIGlobalVariable(name: "start", scope: !0, file: !1, line: 4, type: !6, isLocal: false, isDefinition: true)
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!7 = !{i32 2, !"Dwarf Version", i32 4}
!8 = !{i32 2, !"Debug Info Version", i32 3}
!9 = !{i32 1, !"wchar_size", i32 2}
!10 = !{i32 7, !"PIC Level", i32 2}
!11 = !{!"clang version 10.0.0"}
!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)
!13 = !DISubroutineType(types: !14)
!14 = !{!6, !6}
!15 = !{!16}
!16 = !DILocalVariable(name: "myVar", scope: !12, file: !1, line: 7, type: !6)
!17 = !DILocation(line: 10, scope: !12)

...
---
name: _Z8bb_to_bb
body: |
bb.0.entry:
successors: %bb.1, %bb.2
$ebx = MOV32ri 0, debug-location !17
DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
JCC_1 %bb.2, 4, implicit killed $eflags
bb.1.bb1:
successors: %bb.3
$ebx = MOV32ri 0, debug-location !17
JMP_1 %bb.3
bb.2.bb2:
successors: %bb.3
$eax = MOV32ri 0, debug-location !17
bb.3.bb3:
RETQ $eax, debug-location !17
...
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
--- |
; RUN: llc %s -run-pass=livedebugvalues -o - | FileCheck %s -implicit-check-not=DBG_VALUE

; Check that DBG_VALUE instructions are not propagated into a successor block
; of a diamond CFG that moves its location.

; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-NEXT: $eax = MOV32ri 0, debug-location !17
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17

define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:
br label %bb1, !dbg !17
bb1:
br label %bb2, !dbg !17
bb2:
br label %bb3, !dbg !17
bb3:
ret i32 0, !dbg !17
}

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!7, !8, !9, !10}
!llvm.ident = !{!11}
!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)
!1 = !DIFile(filename: "main.cpp", directory: "F:\")
!2 = !{}
!3 = !{!4}
!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
!5 = distinct !DIGlobalVariable(name: "start", scope: !0, file: !1, line: 4, type: !6, isLocal: false, isDefinition: true)
!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!7 = !{i32 2, !"Dwarf Version", i32 4}
!8 = !{i32 2, !"Debug Info Version", i32 3}
!9 = !{i32 1, !"wchar_size", i32 2}
!10 = !{i32 7, !"PIC Level", i32 2}
!11 = !{!"clang version 10.0.0"}
!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)
!13 = !DISubroutineType(types: !14)
!14 = !{!6, !6}
!15 = !{!16}
!16 = !DILocalVariable(name: "myVar", scope: !12, file: !1, line: 7, type: !6)
!17 = !DILocation(line: 10, scope: !12)

...
---
name: _Z8bb_to_bb
body: |
bb.0.entry:
successors: %bb.1, %bb.2
$ebx = MOV32ri 0, debug-location !17
DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
JCC_1 %bb.2, 4, implicit killed $eflags
bb.1.bb1:
successors: %bb.3
$eax = MOV32ri 0, debug-location !17
DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
JMP_1 %bb.3
bb.2.bb2:
successors: %bb.3
$eax = MOV32ri 0, debug-location !17
bb.3.bb3:
RETQ $eax, debug-location !17
...
Loading

0 comments on commit 35787e3

Please sign in to comment.