[LiveDebugValues][NFC] Add instr-ref tests, adapt old tests

This patch adds a few tests in DebugInfo/MIR/InstrRef/ of interesting
behaviour that the instruction referencing implementation of
LiveDebugValues has. Mostly, these tests exist to ensure that if you
give the "-experimental-debug-variable-locations" command line switch,
the right implementation runs; and to ensure it behaves the same way as
the VarLoc LiveDebugValues implementation.

I've also touched roughly 30 other tests, purely to make the tests less
rigid about what output to accept. DBG_VALUE instructions are usually
printed with a trailing !debug-location indicating its scope:

  !debug-location !1234

However InstrRefBasedLDV produces new DebugLoc instances on the fly,
meaning there sometimes isn't a numbered node when they're printed,
making the output:

  !debug-location !DILocation(line: 0, blah blah)

Which causes a ton of these tests to fail. This patch removes checks for
that final part of each DBG_VALUE instruction. None of them appear to
be actually checking the scope is correct, just that it's present, so
I don't believe there's any loss in coverage here.

Differential Revision: https://reviews.llvm.org/D83054
This commit is contained in:
Jeremy Morse
2020-08-25 16:43:47 +01:00
parent f1a987366f
commit 60db26a66d
27 changed files with 901 additions and 99 deletions

View File

@@ -0,0 +1,100 @@
--- |
; RUN: llc %s -march=x86-64 -run-pass=livedebugvalues -o - -experimental-debug-variable-locations -emulate-old-livedebugvalues=0 | FileCheck %s -implicit-check-not=DBG_VALUE
; This test has two loop heads (bb1, bb2) and a PHI going into bb5. In bb2,
; we need to explore / downgrade from the value of ebx def'd in the entry
; block, through the first loop head, then propose and confirm a PHI at the
; second loop head.
;; Checks represent each DBG_VALUE in the MIR below, and the a live-in
;; DBG_VALUE at the start of each block added by LiveDebugValues.
; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $eax
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx
; CHECK: DBG_VALUE $ebx
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx
; CHECK-LABEL: bb.3.bb3:
; CHECK: DBG_VALUE $ebx
; CHECK: DBG_VALUE $ebx
; CHECK-LABEL: bb.4.bb4:
; CHECK: DBG_VALUE $ebx
; CHECK-LABEL: bb.5.bb5:
; CHECK: DBG_VALUE $ebx
; CHECK-LABEL: bb.6:
; CHECK: DBG_VALUE $ebx
; CHECK-LABEL: bb.7:
; CHECK: DBG_VALUE $ebx
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:
br label %bb3, !dbg !17
bb4:
br label %bb3, !dbg !17
bb5:
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
$ebx = MOV32ri 0, debug-location !17
$eax = COPY $ebx
DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
bb.1.bb1:
successors: %bb.2
$eax = COPY $ebx, debug-location !17
$ebx = COPY $ecx, debug-location !17
DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
bb.2.bb2:
successors: %bb.3, %bb.4
JCC_1 %bb.4, 4, implicit $eflags
bb.3.bb3:
successors: %bb.5
$ebx = MOV32ri 0, debug-location !17
DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
JMP_1 %bb.5
bb.4.bb4:
successors: %bb.5
bb.5.bb5:
successors: %bb.2, %bb.6
JCC_1 %bb.2, 4, implicit killed $eflags
bb.6:
successors: %bb.1, %bb.7
JCC_1 %bb.1, 4, implicit killed $eflags
bb.7:
RETQ $eax, debug-location !17
...

View File

@@ -0,0 +1,112 @@
--- |
; RUN: llc %s -march=x86-64 -run-pass=livedebugvalues -o - | FileCheck %s --implicit-check-not=DBG_VALUE
; RUN: llc %s -march=x86-64 -run-pass=livedebugvalues -o - -experimental-debug-variable-locations | FileCheck %s --implicit-check-not=DBG_VALUE
;
; No DBG_VALUEs should be propagated, as there's a loop between bb2 and bb3
; that defines $rdi without specifying it as being the variable value. Uses
; implicit check-not in runlines above.
;
; CHECK-LABEL: bb.1.while.body
; CHECK: DBG_VALUE
; CHECK-NEXT: TEST8rr
; CHECK-NEXT: JCC_1
; ModuleID = 'multi-downgrade-but-not-sensitive.ll'
source_filename = "/fast/fs/llvm3/clang/lib/CodeGen/CoverageMappingGen.cpp"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%"struct.std::pair.1976" = type { %"class.clang::SourceLocation", i32 }
%"class.clang::SourceLocation" = type { i32 }
; Function Attrs: nounwind uwtable
define weak_odr void @_ZSt17__merge_sort_loopIPSt4pairIN5clang14SourceLocationEjES4_lN9__gnu_cxx5__ops15_Iter_comp_iterIN4llvm11less_secondEEEEvT_SB_T0_T1_T2_(%"struct.std::pair.1976"* %__result) local_unnamed_addr !dbg !12 {
while.body.lr.ph:
br label %while.body, !dbg !17
while.body: ; preds = %while.body, %while.body.i, %while.body.lr.ph
%__result.addr.099 = phi %"struct.std::pair.1976"* [ %__result, %while.body.lr.ph ], [ %__result.addr.099, %while.body ], [ %incdec.ptr7.i, %while.body.i ]
call void @llvm.dbg.value(metadata %"struct.std::pair.1976"* %__result.addr.099, metadata !16, metadata !DIExpression()), !dbg !17
br i1 undef, label %while.body.i.preheader, label %while.body, !dbg !17
while.body.i.preheader: ; preds = %while.body
br label %while.body.i, !dbg !17
while.body.i: ; preds = %while.body.i, %while.body.i.preheader
%__result.addr.046.i = phi %"struct.std::pair.1976"* [ %incdec.ptr7.i, %while.body.i ], [ %__result.addr.099, %while.body.i.preheader ]
%incdec.ptr7.i = getelementptr inbounds %"struct.std::pair.1976", %"struct.std::pair.1976"* %__result.addr.046.i, i64 1, !dbg !17
%cmp.not.i = icmp ne %"struct.std::pair.1976"* undef, undef, !dbg !17
%0 = and i1 undef, %cmp.not.i, !dbg !17
br i1 %0, label %while.body.i, label %while.body, !dbg !17
}
; Function Attrs: nounwind readnone speculatable willreturn
declare void @llvm.dbg.value(metadata, metadata, metadata)
; Function Attrs: nounwind
declare void @llvm.stackprotector(i8*, i8**)
!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: _ZSt17__merge_sort_loopIPSt4pairIN5clang14SourceLocationEjES4_lN9__gnu_cxx5__ops15_Iter_comp_iterIN4llvm11less_secondEEEEvT_SB_T0_T1_T2_
alignment: 16
tracksRegLiveness: true
registers: []
liveins:
- { reg: '$rdi', virtual-reg: '' }
machineFunctionInfo: {}
body: |
bb.0.while.body.lr.ph:
successors: %bb.1(0x80000000)
liveins: $rdi
renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags
bb.1.while.body (align 16):
successors: %bb.2(0x40000000), %bb.1(0x40000000)
liveins: $eax, $rdi
DBG_VALUE $rdi, $noreg, !16, !DIExpression(), debug-location !17
TEST8rr renamable $al, renamable $al, implicit-def $eflags, debug-location !17
JCC_1 %bb.1, 5, implicit killed $eflags, debug-location !17
bb.2.while.body.i (align 16):
successors: %bb.3(0x7e000000), %bb.1(0x02000000)
liveins: $eax, $rdi
renamable $rdi = nuw ADD64ri8 killed renamable $rdi, 8, implicit-def dead $eflags, debug-location !17
TEST8rr renamable $al, renamable $al, implicit-def $eflags, debug-location !17
JCC_1 %bb.1, 5, implicit $eflags, debug-location !17
bb.3.while.body.i:
successors: %bb.2(0x7df7df7e), %bb.1(0x02082082)
liveins: $eax, $rdi
TEST8rr renamable $al, renamable $al, implicit-def $eflags, debug-location !17
JCC_1 %bb.2, 5, implicit $eflags
JMP_1 %bb.1
...

View File

@@ -0,0 +1,273 @@
--- |
; RUN: llc %s -march=x86-64 -run-pass=livedebugvalues -o - | FileCheck %s
; RUN: llc %s -march=x86-64 -run-pass=livedebugvalues -o - -experimental-debug-variable-locations | FileCheck %s
;
; This is a regression test extracted from llvm11ish LICM.cpp. Consider the
; blocks from bb.6 to bb.9: there are two paths to bb.9, one an immediate
; branch, the other takes a longer route. Because VarLocBased LiveDebugValues
; always schedules blocks to be examined in the _next_ dataflow iteration,
; any exploration starting at bb.6 follows this pattern:
; * Round 1: Examine block 6
; * Round 2: Examine block 7 and 9
; * Round 3: Examine block 8
; * Round 4: Examine block 9
; This works for VarLocBased LDV as it has a simple lattice. However for
; InstrRefBasedLDV, in the first examination of block 9 not all predecessors
; will have yet accounted for any changes to block 6's live-outs. It takes
; several iterations for those to reach block 8. This raises the possibility
; of blocks seeing conflicting variable values on their live-in edges, which
; wouldn't be present if their predecessors had been visited beforehand.
;
; It's also not really reverse-post-order visiting.
; Test that a variable value appears in bb.9, which is renumbered 19 during
; mir parsing.
; CHECK-LABEL: bb.19:
; CHECK: DBG_VALUE
; CHECK-NEXT: JMP_1 %bb.19
; ModuleID = 'rpot_bad.ll'
source_filename = "/fast/fs/llvm3/llvm/lib/Transforms/Scalar/LICM.cpp"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: nounwind uwtable
define zeroext i1 @mangled(i64 %LI, i64 %DT, i64 %MSSAU) local_unnamed_addr #0 !dbg !12 {
entry:
ret i1 0
}
declare zeroext i1 @_ZNK4llvm10BasicBlock20canSplitPredecessorsEv() local_unnamed_addr #1
declare i1 @_ZN4llvm22SplitBlockPredecessorsEPNS_10BasicBlockENS_8ArrayRefIS1_EEPKcPNS_13DominatorTreeEPNS_8LoopInfoEPNS_16MemorySSAUpdaterEb() local_unnamed_addr #1
; Function Attrs: nounwind uwtable
declare hidden void @_ZN4llvm9SetVectorIPNS_10BasicBlockENS_11SmallVectorIS2_Lj8EEENS_13SmallDenseSetIS2_Lj8ENS_12DenseMapInfoIS2_EEEEE6insertINS_12PredIteratorIS1_NS_5Value18user_iterator_implINS_4UserEEEEEEEvT_SH_() local_unnamed_addr #0 align 2
; Function Attrs: nounwind readnone speculatable willreturn
declare void @llvm.dbg.value(metadata, metadata, metadata) #2
; Function Attrs: nounwind
declare void @llvm.stackprotector(i8*, i8**) #3
!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: mangled
alignment: 16
tracksRegLiveness: true
liveins:
- { reg: '$rdi' }
- { reg: '$rsi' }
- { reg: '$rdx' }
frameInfo:
stackSize: 56
offsetAdjustment: -56
maxAlignment: 8
adjustsStack: true
hasCalls: true
maxCallFrameSize: 16
cvBytesOfCalleeSavedRegisters: 48
fixedStack:
- { id: 0, type: spill-slot, offset: -56, size: 8, alignment: 8, callee-saved-register: '$rbx' }
- { id: 1, type: spill-slot, offset: -48, size: 8, alignment: 16, callee-saved-register: '$r12' }
- { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, callee-saved-register: '$r13' }
- { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 16, callee-saved-register: '$r14' }
- { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '$r15' }
- { id: 5, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$rbp' }
stack:
- { id: 0, type: spill-slot, offset: -64, size: 8, alignment: 8 }
machineFunctionInfo: {}
body: |
bb.0:
liveins: $rdi, $rdx, $rsi, $rbp, $r15, $r14, $r13, $r12, $rbx
frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
CFI_INSTRUCTION def_cfa_offset 16
frame-setup PUSH64r killed $r15, implicit-def $rsp, implicit $rsp
CFI_INSTRUCTION def_cfa_offset 24
frame-setup PUSH64r killed $r14, implicit-def $rsp, implicit $rsp
CFI_INSTRUCTION def_cfa_offset 32
frame-setup PUSH64r killed $r13, implicit-def $rsp, implicit $rsp
CFI_INSTRUCTION def_cfa_offset 40
frame-setup PUSH64r killed $r12, implicit-def $rsp, implicit $rsp
CFI_INSTRUCTION def_cfa_offset 48
frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
CFI_INSTRUCTION def_cfa_offset 56
frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp
CFI_INSTRUCTION def_cfa_offset 64
CFI_INSTRUCTION offset $rbx, -56
CFI_INSTRUCTION offset $r12, -48
CFI_INSTRUCTION offset $r13, -40
CFI_INSTRUCTION offset $r14, -32
CFI_INSTRUCTION offset $r15, -24
CFI_INSTRUCTION offset $rbp, -16
$r14 = MOV64rr $rdx
$r15 = MOV64rr $rsi
$r12 = MOV64rr $rdi
renamable $r13d = XOR32rr undef $r13d, undef $r13d, implicit-def dead $eflags, implicit-def $r13
renamable $bpl = MOV8ri 1
bb.1:
liveins: $bpl, $r12, $r13, $r14, $r15
renamable $rax = MOV64rm undef renamable $rax, 1, $noreg, 0, $noreg, debug-location !17 :: (load 8 from `i64* undef`)
renamable $rax = AND64ri8 killed renamable $rax, -8, implicit-def dead $eflags, debug-location !17
renamable $rcx = LEA64r renamable $rax, 1, $noreg, -24, $noreg, debug-location !17
TEST64rr renamable $rax, renamable $rax, implicit-def $eflags, debug-location !17
renamable $rcx = CMOV64rr killed renamable $rcx, killed renamable $rax, 4, implicit killed $eflags, debug-location !17
DBG_VALUE $rcx, $noreg, !16, !DIExpression(), debug-location !17
MOV64mr $rsp, 1, $noreg, 0, $noreg, killed renamable $rcx :: (store 8 into %stack.0)
DBG_VALUE $rsp, 0, !16, !DIExpression(), debug-location !17
TEST8rr renamable $r13b, renamable $r13b, implicit-def $eflags, debug-location !17
JCC_1 %bb.1, 5, implicit killed $eflags, debug-location !17
bb.2:
liveins: $bpl, $r12, $r13, $r14, $r15
TEST8rr renamable $r13b, renamable $r13b, implicit-def $eflags, debug-location !17
JCC_1 %bb.1, 5, implicit $eflags, debug-location !17
bb.3:
successors: %bb.4, %bb.1
liveins: $bpl, $r12, $r13, $r14, $r15
TEST8rr renamable $r13b, renamable $r13b, implicit-def $eflags, debug-location !17
JCC_1 %bb.1, 5, implicit $eflags, debug-location !17
bb.4:
successors: %bb.5(0x7c000000), %bb.6(0x04000000)
liveins: $bpl, $r12, $r13, $r14, $r15
TEST8rr renamable $r13b, renamable $r13b, implicit-def $eflags, debug-location !17
JCC_1 %bb.6, 5, implicit $eflags, debug-location !17
bb.5:
successors: %bb.6(0x04000000), %bb.10(0x7c000000)
liveins: $bpl, $r12, $r13, $r14, $r15
CALL64r undef renamable $rax, csr_64, implicit $rsp, implicit $ssp, implicit undef $rdi, implicit-def $rsp, implicit-def $ssp, implicit-def $al, debug-location !17
TEST8rr killed renamable $al, renamable $al, implicit-def $eflags, debug-location !17
JCC_1 %bb.6, 5, implicit $eflags, debug-location !17
bb.10:
liveins: $bpl, $r12, $r13, $r14, $r15
renamable $rax = IMPLICIT_DEF
JMP_1 %bb.11
bb.19:
liveins: $bpl, $r12, $r13, $r14, $r15
renamable $rax = MOV64rm $rsp, 1, $noreg, 0, $noreg :: (load 8 from %stack.0)
renamable $rax = MOV64rm killed renamable $rax, 1, $noreg, 8, $noreg, debug-location !17 :: (load 8 from `i64 *undef`)
bb.11:
successors: %bb.12, %bb.11
liveins: $bpl, $rax, $r12, $r13, $r14, $r15
TEST8rr renamable $r13b, renamable $r13b, implicit-def $eflags, debug-location !17
JCC_1 %bb.11, 5, implicit killed $eflags, debug-location !17
bb.12:
successors: %bb.13, %bb.11
liveins: $bpl, $rax, $r12, $r13, $r14, $r15
TEST8rr renamable $r13b, renamable $r13b, implicit-def $eflags, debug-location !17
JCC_1 %bb.11, 5, implicit $eflags, debug-location !17
bb.13:
liveins: $bpl, $rax, $r12, $r13, $r14, $r15
TEST8rr renamable $r13b, renamable $r13b, implicit-def $eflags, debug-location !17
JCC_1 %bb.11, 5, implicit $eflags, debug-location !17
bb.14:
successors: %bb.15(0x7c000000), %bb.1(0x04000000)
liveins: $bpl, $rax, $r12, $r13, $r14, $r15
renamable $rbx = MOV64rm killed renamable $rax, 1, $noreg, 24, $noreg :: (load 8 from `i64 *undef`)
CALL64pcrel32 @_ZNK4llvm10BasicBlock20canSplitPredecessorsEv, csr_64, implicit $rsp, implicit $ssp, implicit undef $rdi, implicit-def $rsp, implicit-def $ssp, implicit-def $al, debug-location !17
TEST8rr killed renamable $al, renamable $al, implicit-def $eflags, debug-location !17
JCC_1 %bb.1, 4, implicit $eflags, debug-location !17
bb.15:
liveins: $bpl, $rbx, $r12, $r13, $r14, $r15
renamable $rbx = MOV64rm killed renamable $rbx, 1, $noreg, 40, $noreg, debug-location !17 :: (load 8 from `i64 *undef`)
dead $edx = XOR32rr undef $edx, undef $edx, implicit-def dead $eflags, implicit-def $rdx, debug-location !17
CALL64pcrel32 @_ZN4llvm9SetVectorIPNS_10BasicBlockENS_11SmallVectorIS2_Lj8EEENS_13SmallDenseSetIS2_Lj8ENS_12DenseMapInfoIS2_EEEEE6insertINS_12PredIteratorIS1_NS_5Value18user_iterator_implINS_4UserEEEEEEEvT_SH_, csr_64, implicit $rsp, implicit $ssp, implicit undef $rdi, implicit undef $rsi, implicit $rdx, implicit-def $rsp, implicit-def $ssp, debug-location !17
bb.16:
successors: %bb.19(0x061801fc), %bb.17(0x79e7fe04)
liveins: $bpl, $r12, $r13, $r14, $r15, $rbx
CMP32mi8 undef renamable $rax, 1, $noreg, 0, $noreg, 0, implicit-def $eflags, debug-location !17 :: (load 4 from `i32* undef`, align 8)
JCC_1 %bb.19, 4, implicit $eflags, debug-location !17
bb.17:
successors: %bb.16(0x30000000), %bb.18(0x50000000)
liveins: $bpl, $rbx, $r12, $r13, $r14, $r15
TEST8rr renamable $bpl, renamable $bpl, implicit-def $eflags, debug-location !17
JCC_1 %bb.16, 5, implicit $eflags, debug-location !17
bb.18:
liveins: $bpl, $rbx, $r12, $r13, $r14, $r15
$edx = MOV32ri 1, implicit-def $rdx, debug-location !17
;$ecx = MOV32ri @.str.282, implicit-def $rcx, debug-location !17
$ecx = MOV32ri 1, debug-location !17
$rdi = MOV64rr $rbx, debug-location !17
$r8 = MOV64rr $r15, debug-location !17
$r9 = MOV64rr $r12, debug-location !17
PUSH64i8 1, implicit-def $rsp, implicit $rsp, debug-location !17 :: (store 4 into stack + 8)
CFI_INSTRUCTION adjust_cfa_offset 8, debug-location !17
PUSH64r renamable $r14, implicit-def $rsp, implicit $rsp, debug-location !17 :: (store 8 into stack)
CFI_INSTRUCTION adjust_cfa_offset 8, debug-location !17
CALL64pcrel32 @_ZN4llvm22SplitBlockPredecessorsEPNS_10BasicBlockENS_8ArrayRefIS1_EEPKcPNS_13DominatorTreeEPNS_8LoopInfoEPNS_16MemorySSAUpdaterEb, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit undef $rsi, implicit $rdx, implicit $rcx, implicit $r8, implicit $r9, implicit-def $rsp, implicit-def $ssp, implicit-def dead $rax, debug-location !17
$rsp = ADD64ri8 $rsp, 16, implicit-def dead $eflags, debug-location !17
CFI_INSTRUCTION adjust_cfa_offset -16, debug-location !17
JMP_1 %bb.16
bb.6:
renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags
TEST8rr renamable $al, renamable $al, implicit-def $eflags, implicit killed $eax, debug-location !17
JCC_1 %bb.9, 5, implicit $eflags, debug-location !17
bb.7:
renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags
bb.8:
successors: %bb.9(0x04000000), %bb.8(0x7c000000)
liveins: $eax
TEST8rr renamable $al, renamable $al, implicit-def $eflags, debug-location !17
JCC_1 %bb.8, 5, implicit killed $eflags, debug-location !17
bb.9:
JMP_1 %bb.9
...

View File

@@ -21,7 +21,7 @@
#
# Check that last bundled instruction of block gets recognized as end of basic block.
# CHECK: bb.2.if.end
# CHECK-NEXT: DBG_VALUE $s0, $noreg, !12, !DIExpression(), debug-location !17
# CHECK-NEXT: DBG_VALUE $s0, $noreg, !12, !DIExpression()
--- |
; ModuleID = '<stdin>'

View File

@@ -14,8 +14,8 @@
# ...
#
# CHECK: bb.1.if.end:
# CHECK: DBG_VALUE $rbp, 0, !37, !DIExpression(DW_OP_constu, 44, DW_OP_minus), debug-location !58
# CHECK-NOT: DBG_VALUE $rbp, 0, !36, !DIExpression(DW_OP_constu, 48, DW_OP_minus), debug-location !57
# CHECK: DBG_VALUE $rbp, 0, !37, !DIExpression(DW_OP_constu, 44, DW_OP_minus)
# CHECK-NOT: DBG_VALUE $rbp, 0, !36, !DIExpression(DW_OP_constu, 48, DW_OP_minus)
--- |
; ModuleID = '<stdin>'
@@ -283,7 +283,7 @@ body: |
$r13 = MOV64rr $rax
renamable $ecx = XOR32rr undef $ecx, undef $ecx, implicit-def dead $eflags
renamable $r13 = AND64rr killed renamable $r13, renamable $r14, implicit-def $eflags
JCC_1 %bb.9, 4, implicit $eflags
JCC_1 %bb.9, 4, implicit $eflags, debug-location !57
bb.1.if.end:
successors: %bb.2(0x30000000), %bb.3(0x50000000)
@@ -301,7 +301,7 @@ body: |
$r12 = MOV64rr $rax
$r15 = MOV64rr $r12
renamable $r15 = AND64ri8 killed renamable $r15, -123, implicit-def $eflags
JCC_1 %bb.2, 4, implicit $eflags
JCC_1 %bb.2, 4, implicit $eflags, debug-location !57
bb.3.private.exit:
successors: %bb.9(0x30000000), %bb.4(0x50000000)
@@ -316,7 +316,7 @@ body: |
CALL64pcrel32 @func4, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp, implicit-def $eax
renamable $ecx = MOV32ri 1
TEST32rr killed renamable $eax, renamable $eax, implicit-def $eflags
JCC_1 %bb.9, 4, implicit $eflags
JCC_1 %bb.9, 4, implicit $eflags, debug-location !57
bb.4.if.then8:
successors: %bb.8(0x30000000), %bb.5(0x50000000)
@@ -327,21 +327,21 @@ body: |
CALL64pcrel32 @func5, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit $esi, implicit-def $rsp, implicit-def $ssp
renamable $rax = MOV64rm killed renamable $r13, 1, $noreg, 8, $noreg :: (load 8 from %ir.13)
TEST64rr renamable $rax, renamable $rax, implicit-def $eflags
JCC_1 %bb.8, 4, implicit $eflags
JCC_1 %bb.8, 4, implicit $eflags, debug-location !57
bb.5.land.lhs.true:
successors: %bb.6(0x30000000), %bb.7(0x50000000)
liveins: $rax, $r12, $r15
CMP32mi8 renamable $r15, 1, $noreg, 0, $noreg, 0, implicit-def $eflags :: (load 4 from %ir.tot_perf2, align 8)
JCC_1 %bb.7, 5, implicit $eflags
JCC_1 %bb.7, 5, implicit $eflags, debug-location !57
bb.6.lor.lhs.false:
successors: %bb.8(0x30000000), %bb.7(0x50000000)
liveins: $rax, $r12, $r15
CMP32mi8 killed renamable $r15, 1, $noreg, 4, $noreg, 0, implicit-def $eflags :: (load 4 from %ir.tot_bw)
JCC_1 %bb.8, 4, implicit $eflags
JCC_1 %bb.8, 4, implicit $eflags, debug-location !57
bb.7.if.then14:
successors: %bb.8(0x80000000)
@@ -350,13 +350,13 @@ body: |
renamable $rdx = MOV64rm killed renamable $rax, 1, $noreg, 8, $noreg :: (load 8 from %ir.20)
$rdi = MOV64rr killed $r12
$esi = MOV32rm $rbp, 1, $noreg, -44, $noreg :: (load 4 from %stack.1)
CALL64pcrel32 @func6, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit $esi, implicit $rdx, implicit-def $rsp, implicit-def $ssp
CALL64pcrel32 @func6, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit $esi, implicit $rdx, implicit-def $rsp, implicit-def $ssp, debug-location !57
bb.8.cleanup:
successors: %bb.9(0x80000000)
renamable $ecx = MOV32ri 1
JMP_1 %bb.9
JMP_1 %bb.9, debug-location !57
bb.2.if.then3:
successors: %bb.9(0x80000000)
@@ -369,7 +369,7 @@ body: |
$edx = MOV32ri 5
$r8d = MOV32rm $rbp, 1, $noreg, -48, $noreg :: (load 4 from %stack.0)
CALL64pcrel32 @func3, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi, implicit $edx, implicit $rcx, implicit $r8d, implicit-def $rsp, implicit-def $ssp
renamable $ecx = XOR32rr undef $ecx, undef $ecx, implicit-def dead $eflags
renamable $ecx = XOR32rr undef $ecx, undef $ecx, implicit-def dead $eflags, debug-location !57
bb.9.cleanup:
liveins: $ecx
@@ -382,6 +382,6 @@ body: |
$r14 = POP64r implicit-def $rsp, implicit $rsp
$r15 = POP64r implicit-def $rsp, implicit $rsp
$rbp = POP64r implicit-def $rsp, implicit $rsp
RETQ $eax
RETQ $eax, debug-location !57
...

View File

@@ -31,9 +31,9 @@
# DBG_VALUE for variables "x", "y" and "z" are extended into %bb.9 from its
# predecessors %bb.0, %bb.2 and %bb.8.
# CHECK: bb.9.for.end:
# CHECK-DAG: DBG_VALUE $edi, $noreg, ![[X_VAR]], !DIExpression(), debug-location !{{[0-9]+}}
# CHECK-DAG: DBG_VALUE $esi, $noreg, ![[Y_VAR]], !DIExpression(), debug-location !{{[0-9]+}}
# CHECK-DAG: DBG_VALUE $edx, $noreg, ![[Z_VAR]], !DIExpression(), debug-location !{{[0-9]+}}
# CHECK-DAG: DBG_VALUE $edi, $noreg, ![[X_VAR]], !DIExpression()
# CHECK-DAG: DBG_VALUE $esi, $noreg, ![[Y_VAR]], !DIExpression()
# CHECK-DAG: DBG_VALUE $edx, $noreg, ![[Z_VAR]], !DIExpression()
# CHECK: RET
--- |

View File

@@ -1,4 +1,5 @@
# RUN: llc %s -mtriple=x86_64-unknown-unknown -o - -run-pass=livedebugvalues | FileCheck %s --implicit-check-not=DBG_VALUE
# RUN: llc %s -mtriple=x86_64-unknown-unknown -o - -run-pass=livedebugvalues -experimental-debug-variable-locations | FileCheck %s -check-prefix=NEWLDV --implicit-check-not=DBG_VALUE
#
# Test that the DBG_VALUE of ecx below does not get propagated. It is considered
# live-in on LiveDebugValues' first pass through the loop, but on the second it
@@ -17,6 +18,13 @@
# CHECK-LABEL: bb.1.loop:
# CHECK: $ebx = COPY killed $ecx
# CHECK-NEXT: DBG_VALUE
#
# This doesn't occur under value-tracking LiveDebugValues though.
#
# NEWLDV-LABEL: name: foo
# NEWLDV-LABEL: bb.0.entry:
# NEWLDV: $ecx = MOV32ri 0
# NEWLDV-NEXT: DBG_VALUE
--- |
source_filename = "live-debug-values-remove-range.ll"
@@ -74,30 +82,30 @@ body: |
CFI_INSTRUCTION def_cfa_offset 16
CFI_INSTRUCTION offset $rbx, -16
$ebx = MOV32rr $edi
$eax = MOV32ri 0
$ecx = MOV32ri 0
$eax = MOV32ri 0, debug-location !10
$ecx = MOV32ri 0, debug-location !10
DBG_VALUE $ecx, $noreg, !9, !DIExpression(), debug-location !10
$edi = MOV32ri 0
$esi = MOV32ri 0
$edi = MOV32ri 0, debug-location !10
$esi = MOV32ri 0, debug-location !10
bb.1.loop:
successors: %bb.1, %bb.2
liveins: $ebx, $eax, $ecx, $edi, $esi
$eax = COPY $ecx
$ebx = COPY killed $ecx
$ecx = COPY killed $edi
$edi = COPY killed $esi
$esi = MOV32ri 1
$eax = COPY $ecx, debug-location !10
$ebx = COPY killed $ecx, debug-location !10
$ecx = COPY killed $edi, debug-location !10
$edi = COPY killed $esi, debug-location !10
$esi = MOV32ri 1, debug-location !10
TEST8ri killed renamable $al, 1, implicit-def $eflags
JCC_1 %bb.1, 5, implicit killed $eflags
JCC_1 %bb.1, 5, implicit killed $eflags, debug-location !10
bb.2.exit:
liveins: $ebx
$eax = MOV32rr killed $ebx
$eax = MOV32rr killed $ebx, debug-location !10
$rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp
CFI_INSTRUCTION def_cfa_offset 8
RETQ $eax
RETQ $eax, debug-location !10
...

View File

@@ -35,7 +35,7 @@
# CHECK: ![[N_VAR:[0-9]+]] = !DILocalVariable(name: "n",{{.*}})
#
# CHECK: bb.5.if.end.7:
# CHECK: DBG_VALUE $ebx, $noreg, ![[N_VAR]], !DIExpression(), debug-location !{{[0-9]+}}
# CHECK: DBG_VALUE $ebx, $noreg, ![[N_VAR]], !DIExpression()
--- |

View File

@@ -6,11 +6,11 @@
; 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: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.3.bb3:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:

View File

@@ -5,13 +5,13 @@
; 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: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.3.bb3:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:

View File

@@ -5,12 +5,12 @@
; 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: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-NEXT: $ebx = MOV32ri 0, debug-location !17
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-NEXT: $ebx = MOV32ri 0, debug-location !17
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {

View File

@@ -5,17 +5,17 @@
; 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: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-NEXT: $eax = MOV32ri 0, debug-location !17
; CHECK-NEXT: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-NEXT: DBG_VALUE $eax, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-NEXT: $eax = MOV32ri 0, debug-location !17
; CHECK-NEXT: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
; CHECK-NEXT: DBG_VALUE $eax, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.3.bb3:
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression()
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:

View File

@@ -5,11 +5,11 @@
; of a diamond CFG that clobbers its location.
; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:

View File

@@ -5,13 +5,13 @@
; of a diamond CFG that moves its location.
; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-NEXT: $eax = MOV32ri 0, debug-location !17
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:

View File

@@ -5,13 +5,13 @@
; loop that doesn't move or clobber its location.
; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.3.bb3:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:

View File

@@ -5,13 +5,13 @@
; sequential CFG.
; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.3.bb3:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:

View File

@@ -5,9 +5,9 @@
; control flow when it's location is clobbered.
; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:

View File

@@ -5,13 +5,13 @@
; no control flow when a location is moved and then clobbered.
; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-NEXT: $eax = MOV32ri 0, debug-location !17
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.3.bb3:
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {

View File

@@ -0,0 +1,113 @@
--- |
; RUN: llc %s -march=x86-64 -run-pass=livedebugvalues -o - -experimental-debug-variable-locations -emulate-old-livedebugvalues=0 | FileCheck %s -implicit-check-not=DBG_VALUE
; Sometimes, variables can have multiple locations, and when control flow
; merges LiveDebugValues has a hard time picking which one the variable lives
; in. Test two of these scenarios that old LiveDebugValues can't handle: when
; a value is in two registers, and when a value is both in a register and
; on the stack.
; In a register:
; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $rdi, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $rbp, $noreg, !16, !DIExpression()
; CHECK: DBG_VALUE $rbp, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $rbp, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.3.bb3:
; CHECK: DBG_VALUE $rbp, $noreg, !16, !DIExpression()
; On the stack: we move from $rbp to a stack slot in bb4, but join back on
; $rbp in bb6.
; CHECK-LABEL: bb.4:
; CHECK: DBG_VALUE $rbp, $noreg, !16, !DIExpression()
; CHECK: DBG_VALUE $rsp, 0, !16, !DIExpression()
; CHECK-LABEL: bb.5:
; CHECK: DBG_VALUE $rbp, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.6:
; CHECK: DBG_VALUE $rbp, $noreg, !16, !DIExpression()
declare i64 @bees(i64 %arg);
define i32 @_Z8bb_to_bb(i64 %arg) 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
tracksRegLiveness: true
liveins:
- { reg: '$rdi', virtual-reg: '' }
stack:
- { id: 0, name: '', type: spill-slot, offset: -8, size: 8, alignment: 8,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
body: |
bb.0.entry:
liveins: $rdi
successors: %bb.1, %bb.2
DBG_VALUE $rdi, $noreg, !16, !DIExpression(), debug-location !17
$rbp = MOV64rr $rdi, debug-location !17
dead $rcx = MOV64ri 0, debug-location !17
CALL64pcrel32 @bees, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp, implicit-def $rax, debug-location !17
CMP64ri8 renamable $rax, 1, implicit-def $eflags, debug-location !17
JCC_1 %bb.2, 4, implicit killed $eflags, debug-location !17
bb.1.bb1:
liveins: $rax, $rbp
successors: %bb.3
$rbp = MOV64ri 0, debug-location !17
DBG_VALUE $rbp, $noreg, !16, !DIExpression(), debug-location !17
JMP_1 %bb.3
bb.2.bb2:
liveins: $rax, $rbp
successors: %bb.3
$rax = MOV64ri 0, debug-location !17
bb.3.bb3:
liveins: $rax, $rbp
$rdi = MOV64rr $rbp, debug-location !17
CALL64pcrel32 @bees, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp, implicit-def $rax, debug-location !17
CMP64ri8 renamable $rax, 1, implicit-def $eflags, debug-location !17
JCC_1 %bb.5, 4, implicit killed $eflags, debug-location !17
bb.4:
liveins: $rax, $rbp
MOV64mr $rsp, 1, $noreg, 8, $noreg, killed renamable $rbp :: (store 8 into %stack.0)
JMP_1 %bb.6
bb.5:
liveins: $rax, $rbp
bb.6:
liveins: $rax, $rbp
RETQ $rax, debug-location !17
...

View File

@@ -5,15 +5,15 @@
; break.
; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.3.bb3:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.4.bb4:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:

View File

@@ -5,17 +5,17 @@
; diamond pattern and beyond.
; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.3.bb3:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.4.bb4:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.5.bb5:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:

View File

@@ -5,17 +5,17 @@
; diamond pattern but not beyond.
; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.3.bb3:
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.4.bb4:
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.5.bb5:
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression()
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:

View File

@@ -5,15 +5,15 @@
; backedges and beyond.
; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.3.bb3:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.4.bb4:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:

View File

@@ -4,17 +4,17 @@
; Check that DBG_VALUE instructions are propagated into loops within loops.
; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.1.bb1:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.2.bb2:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.3.bb3:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.4.bb4:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.5.bb5:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:

View File

@@ -5,9 +5,9 @@
; loops that move their locations.
; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.3.bb3:
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression()
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:

View File

@@ -5,11 +5,11 @@
; loops that move their locations.
; CHECK-LABEL: bb.0.entry:
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $ebx, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.4.bb4:
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression()
; CHECK-LABEL: bb.5.bb5:
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression(), debug-location !17
; CHECK: DBG_VALUE $eax, $noreg, !16, !DIExpression()
define i32 @_Z8bb_to_bb() local_unnamed_addr !dbg !12 {
entry:

View File

@@ -0,0 +1,196 @@
--- |
; RUN: llc %s -march=x86-64 -run-pass=livedebugvalues -o - -experimental-debug-variable-locations | FileCheck %s -implicit-check-not=DBG_VALUE
; The MIR below represents a pathalogical case for value-tracking
; LiveDebugValues. The code structure is eight nested loops, with loop heads
; from bb.1 to bb.8, a central block bb.9 that does nothing, and loop ends
; from bb.10 to bb.17. The CMP's and jumps might be broken; the only
; important part is that it looks like nested loops to LiveDebugValues.
;
; The variable location is always $rsi, which enters the function live.
; There's also a def of $rsi in bb.14, in a loop tail, half way into the
; loop nest.s.
;
; This presents a serious problem: the outer four loops each implicitly have
; a PHI value for $rsi, because the block could be entered on a path straight
; from entry, or from bb.14 where $rsi is def'd. While the innermost four
; loops have a value of $rsi that is live-through each loop from bb.5
; onwards.
;
; Value-tracking LiveDebugValues _must_ correctly identify each PHI value.
; Observe the DBG_VALUE in bb.2: this variable location musn't be propagated
; any further, because there's a path to either successor that goes through
; bb.14 where the value is overwritten.Value tracking needs to identify the
; PHI value on entry to the block; and that each successor has a different
; PHI value in that register.
;
; Likewise, we mustn't identify values as PHIs which aren't. Entering bb.5
; has a PHI value (from bb.4) in $rsi. There are no paths to bb.5 that pass
; through the clobbering bb.14, which don't also pass through bb.4: thus
; that value is live-through the innermost four loops. If we
; over-approximated where PHIs happened, we would lose variable location
; coverage here, by not propagating the variable location through the inner
; loops.
;
; Getting this right requires the lattice descent (described in the
; implementation) to search loop head PHI values, until one is found that is
; live-through a loop.
; This location in bb.2 should not be propagated further,
; CHECK-LABEL: bb.2:
; CHECK: DBG_VALUE $rsi, $noreg
; This location should be live through the inner loops, til bb.14
; CHECK-LABEL: bb.5:
; CHECK: DBG_VALUE $rsi, $noreg
; CHECK-LABEL: bb.6:
; CHECK: DBG_VALUE $rsi, $noreg
; CHECK-LABEL: bb.7:
; CHECK: DBG_VALUE $rsi, $noreg
; CHECK-LABEL: bb.8:
; CHECK: DBG_VALUE $rsi, $noreg
; CHECK-LABEL: bb.9:
; CHECK: DBG_VALUE $rsi, $noreg
; CHECK-LABEL: bb.10:
; CHECK: DBG_VALUE $rsi, $noreg
; CHECK-LABEL: bb.11:
; CHECK: DBG_VALUE $rsi, $noreg
; CHECK-LABEL: bb.12:
; CHECK: DBG_VALUE $rsi, $noreg
; CHECK-LABEL: bb.13:
; CHECK: DBG_VALUE $rsi, $noreg
declare i64 @bees(i64 %arg);
define i32 @chiasm(i64 %arg) 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: chiasm
tracksRegLiveness: true
liveins:
- { reg: '$rdi', virtual-reg: '' }
stack:
- { id: 0, name: '', type: spill-slot, offset: -8, size: 8, alignment: 8,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
body: |
bb.0.entry:
liveins: $rdi, $rsi
bb.1:
liveins: $rsi, $rdi
CMP64ri8 renamable $rdi, 1, implicit-def $eflags, debug-location !17
JCC_1 %bb.17, 4, implicit $eflags, debug-location !17
bb.2:
liveins: $rsi, $rdi
DBG_VALUE $rsi, $noreg, !16, !DIExpression(), debug-location !17
CMP64ri8 renamable $rdi, 2, implicit-def $eflags, debug-location !17
JCC_1 %bb.16, 4, implicit $eflags, debug-location !17
bb.3:
liveins: $rsi, $rdi
CMP64ri8 renamable $rdi, 3, implicit-def $eflags, debug-location !17
JCC_1 %bb.15, 4, implicit $eflags, debug-location !17
bb.4:
liveins: $rsi, $rdi
CMP64ri8 renamable $rdi, 4, implicit-def $eflags, debug-location !17
JCC_1 %bb.14, 4, implicit $eflags, debug-location !17
bb.5:
liveins: $rsi, $rdi
DBG_VALUE $rsi, $noreg, !16, !DIExpression(), debug-location !17
CMP64ri8 renamable $rdi, 4, implicit-def $eflags, debug-location !17
JCC_1 %bb.13, 4, implicit $eflags, debug-location !17
bb.6:
liveins: $rsi, $rdi
CMP64ri8 renamable $rdi, 4, implicit-def $eflags, debug-location !17
JCC_1 %bb.12, 4, implicit $eflags, debug-location !17
bb.7:
liveins: $rsi, $rdi
CMP64ri8 renamable $rdi, 4, implicit-def $eflags, debug-location !17
JCC_1 %bb.11, 4, implicit $eflags, debug-location !17
bb.8:
liveins: $rsi, $rdi
CMP64ri8 renamable $rdi, 4, implicit-def $eflags, debug-location !17
JCC_1 %bb.10, 4, implicit $eflags, debug-location !17
bb.9:
liveins: $rsi, $rdi, $eflags
;$rsi = MOV64ri 0, debug-location !17
;JMP_1 %bb.1, debug-location !17
bb.10:
liveins: $rsi, $rdi, $eflags
JCC_1 %bb.8, 4, implicit $eflags, debug-location !17
bb.11:
liveins: $rsi, $rdi, $eflags
JCC_1 %bb.7, 4, implicit $eflags, debug-location !17
bb.12:
liveins: $rsi, $rdi, $eflags
JCC_1 %bb.6, 4, implicit $eflags, debug-location !17
bb.13:
liveins: $rsi, $rdi, $eflags
JCC_1 %bb.5, 4, implicit $eflags, debug-location !17
bb.14:
liveins: $rsi, $rdi, $eflags
$rsi = MOV64ri 0, debug-location !17
JCC_1 %bb.4, 4, implicit $eflags, debug-location !17
bb.15:
liveins: $rsi, $rdi, $eflags
JCC_1 %bb.3, 4, implicit $eflags, debug-location !17
bb.16:
liveins: $rsi, $rdi, $eflags
JCC_1 %bb.2, 4, implicit $eflags, debug-location !17
bb.17:
liveins: $rsi, $rdi, $eflags
JCC_1 %bb.1, 4, implicit $eflags, debug-location !17
bb.18:
liveins: $rsi, $rdi, $eflags
RETQ
...