1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
# RUN: llc --run-pass=livedebugvalues -o - %s | FileCheck %s --implicit-check-not=DBG_VALUE
# REQUIRES: x86-registered-target
# This test covers the scenario where a DBG_VALUE created prior to LiveDebugValues has an entry-value expression.
# It ensures that a clobbered stack copy doesn't crash if used as an entry-value because entry-values can't be clobbered.
--- |
target triple = "x86_64-"
define i32 @baz(i32 swiftasync %arg1, i32 noundef %arg2, i1 %cond) !dbg !9 {
tail call void @llvm.dbg.value(metadata i32 %arg1, metadata !17, metadata !DIExpression(DW_OP_LLVM_entry_value, 1)), !dbg !19
br i1 %cond, label %if.then, label %if.else, !dbg !22
if.then:
%call = call i32 @foo(i32 noundef %arg1), !dbg !23
br label %if.end, !dbg !25
if.else:
%call1 = call i32 @foo(i32 noundef %arg2), !dbg !26
br label %if.end
if.end:
%temp.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ], !dbg !28
ret i32 %temp.0, !dbg !29
}
declare i32 @foo(i32)
declare void @llvm.dbg.value(metadata, metadata, metadata)
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!2, !3}
!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "ha", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
!1 = !DIFile(filename: "test.c", directory: "hah")
!2 = !{i32 7, !"Dwarf Version", i32 4}
!3 = !{i32 2, !"Debug Info Version", i32 3}
!9 = distinct !DISubprogram(name: "baz", scope: !1, file: !1, line: 3, type: !10, scopeLine: 3, unit: !0, retainedNodes: !13)
!10 = !DISubroutineType(types: !11)
!11 = !{!12, !12, !12, !12}
!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!13 = !{!14, !15, !16, !17}
!14 = !DILocalVariable(name: "arg1", arg: 1, scope: !9, file: !1, line: 3, type: !12)
!15 = !DILocalVariable(name: "arg2", arg: 2, scope: !9, file: !1, line: 3, type: !12)
!16 = !DILocalVariable(name: "cond", arg: 3, scope: !9, file: !1, line: 3, type: !12)
!17 = !DILocalVariable(name: "local", scope: !9, file: !1, line: 4, type: !12)
!19 = !DILocation(line: 0, scope: !9)
!20 = !DILocation(line: 7, column: 7, scope: !21)
!21 = distinct !DILexicalBlock(scope: !9, file: !1, line: 7, column: 7)
!22 = !DILocation(line: 7, column: 7, scope: !9)
!23 = !DILocation(line: 8, column: 12, scope: !24)
!24 = distinct !DILexicalBlock(scope: !21, file: !1, line: 7, column: 13)
!25 = !DILocation(line: 9, column: 3, scope: !24)
!26 = !DILocation(line: 10, column: 12, scope: !27)
!27 = distinct !DILexicalBlock(scope: !21, file: !1, line: 9, column: 10)
!28 = !DILocation(line: 0, scope: !21)
!29 = !DILocation(line: 13, column: 3, scope: !9)
...
---
name: baz
alignment: 16
debugInstrRef: true
tracksDebugUserValues: true
liveins:
- { reg: '$r14', virtual-reg: '' }
- { reg: '$edi', virtual-reg: '' }
- { reg: '$esi', virtual-reg: '' }
- { reg: '$edx', virtual-reg: '' }
body: |
bb.0:
successors: %bb.2(0x40000000), %bb.1(0x40000000)
liveins: $r14, $edi, $edx, $esi
DBG_VALUE $r14, $noreg, !14, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !19
CMP32ri killed renamable $edx, 0, implicit-def $eflags, debug-location !20
JCC_1 %bb.2, 4, implicit killed $eflags, debug-location !22
bb.1.if.then:
successors: %bb.3(0x80000000)
liveins: $edi, $r13
CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit-def $eax, debug-location !23
$r14 = MOV64ri 0, debug-location !20
JMP_1 %bb.3, debug-location !25
bb.2.if.else:
successors: %bb.3(0x80000000)
liveins: $esi, $r13
$edi = MOV32rr killed $esi, debug-location !26
CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit-def $eax, debug-location !26
bb.3.if.end:
liveins: $eax
$rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !29
RET64 implicit $eax, debug-location !29
# CHECK-LABEL: bb.0:
# CHECK: DBG_VALUE $r14, {{.*}}, !DIExpression(DW_OP_LLVM_entry_value, 1)
# CHECK-LABEL: bb.1.if.then:
# CHECK: DBG_VALUE $r14, {{.*}}, !DIExpression(DW_OP_LLVM_entry_value, 1)
# CHECK-NEXT: CALL64pcrel32 @foo
# CHECK-NEXT: $r14 = MOV64ri 0
# CHECK-NOT: DBG_VALUE $r14, {{.*}}, !DIExpression(DW_OP_LLVM_entry_value, 1)
# CHECK-LABEL: bb.2.if.else:
# CHECK: DBG_VALUE $r14, {{.*}}, !DIExpression(DW_OP_LLVM_entry_value, 1)
# CHECK-LABEL: bb.3.if.end:
# CHECK: DBG_VALUE $r14, {{.*}}, !DIExpression(DW_OP_LLVM_entry_value, 1)
|