1 # RUN: llc %s -mtriple=x86_64-unknown-unknown -o - -run-pass=livedebugvalues | FileCheck %s --implicit-check-not=DBG_VALUE
2 # 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
4 # Test that the DBG_VALUE of ecx below does not get propagated. It is considered
5 # live-in on LiveDebugValues' first pass through the loop, but on the second it
6 # should be removed from the InLocs set because it gets clobbered inside the
7 # loop. There should be no transfer from ecx to ebx -- this is ensured by the
8 # FileCheck implicit-check-not option.
10 # FIXME: we successfully prevent the false location (ebx) from being
11 # propagated into block 2, but the original transfer isn't yet eliminated.
12 # Thus we get no DBG_VALUe in block 2, but an invalid one in block 1.
14 # CHECK-LABEL: name: foo
15 # CHECK-LABEL: bb.0.entry:
16 # CHECK: $ecx = MOV32ri 0
17 # CHECK-NEXT: DBG_VALUE
18 # CHECK-LABEL: bb.1.loop:
19 # CHECK: $ebx = COPY killed $ecx
20 # CHECK-NEXT: DBG_VALUE
22 # This doesn't occur under value-tracking LiveDebugValues though.
24 # NEWLDV-LABEL: name: foo
25 # NEWLDV-LABEL: bb.0.entry:
26 # NEWLDV: $ecx = MOV32ri 0
27 # NEWLDV-NEXT: DBG_VALUE
30 source_filename = "live-debug-values-remove-range.ll"
31 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
33 declare void @llvm.dbg.value(metadata, metadata, metadata)
35 define i32 @foo(i32 %bar) !dbg !4 {
44 !llvm.module.flags = !{!0, !1}
47 !0 = !{i32 2, !"Debug Info Version", i32 3}
48 !1 = !{i32 2, !"Dwarf Version", i32 4}
49 !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "beards", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
50 !3 = !DIFile(filename: "bees.cpp", directory: ".")
51 !4 = distinct !DISubprogram(name: "nope", scope: !3, file: !3, line: 1, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !8)
52 !5 = !DISubroutineType(types: !6)
54 !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
56 !9 = !DILocalVariable(name: "thin", scope: !4, file: !3, line: 1, type: !7)
57 !10 = !DILocation(line: 1, scope: !4)
63 tracksRegLiveness: true
73 cvBytesOfCalleeSavedRegisters: 8
75 - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$rbx' }
76 machineFunctionInfo: {}
81 frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
82 CFI_INSTRUCTION def_cfa_offset 16
83 CFI_INSTRUCTION offset $rbx, -16
85 $eax = MOV32ri 0, debug-location !10
86 $ecx = MOV32ri 0, debug-location !10
87 DBG_VALUE $ecx, $noreg, !9, !DIExpression(), debug-location !10
88 $edi = MOV32ri 0, debug-location !10
89 $esi = MOV32ri 0, debug-location !10
92 successors: %bb.1, %bb.2
93 liveins: $ebx, $eax, $ecx, $edi, $esi
95 $eax = COPY $ecx, debug-location !10
96 $ebx = COPY killed $ecx, debug-location !10
97 $ecx = COPY killed $edi, debug-location !10
98 $edi = COPY killed $esi, debug-location !10
99 $esi = MOV32ri 1, debug-location !10
100 TEST8ri killed renamable $al, 1, implicit-def $eflags
101 JCC_1 %bb.1, 5, implicit killed $eflags, debug-location !10
106 $eax = MOV32rr killed $ebx, debug-location !10
107 $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp
108 CFI_INSTRUCTION def_cfa_offset 8
109 RETQ $eax, debug-location !10