1 # RUN: llc %s -run-pass=livedebugvalues -experimental-debug-variable-locations\
2 # RUN: -o - | FileCheck %s
4 # In the MIR below, there's an argument in the lowest byte of $edi. The debug
5 # intrinsics correctly identify the value and where it becomes the variables
6 # value, however a bug in InstrRefBasedLDV meant that not all subregisters of
7 # DBG_PHI operands are tracked. That leads to the wrong DBG_VALUE location
8 # being produced, and a crash under asan.
10 # CHECK-LABEL: name: foo
12 # CHECK-NEXT: DBG_INSTR_REF {{.+}}, dbg-instr-ref(2, 0)
\r
13 # CHECK-NEXT: DBG_VALUE_LIST {{.+}} $dil
\r
16 source_filename = "out.ll"
17 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
18 target triple = "x86_64-scei-ps4"
20 @someglobal = external local_unnamed_addr global i8, align 1
22 define hidden void @foo(i1 zeroext %bar) !dbg !7 {
27 declare void @llvm.dbg.value(metadata, metadata, metadata)
30 !llvm.module.flags = !{!3, !4, !5}
33 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
34 !1 = !DIFile(filename: "test.c", directory: "/tmp/out.c")
36 !3 = !{i32 7, !"Dwarf Version", i32 4}
37 !4 = !{i32 2, !"Debug Info Version", i32 3}
38 !5 = !{i32 1, !"wchar_size", i32 4}
40 !7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
41 !8 = !DISubroutineType(types: !9)
43 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
44 !11 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)
45 !12 = !DILocalVariable(name: "baz", arg: 2, scope: !7, file: !1, line: 3, type: !11)
46 !13 = !DILocation(line: 0, scope: !7)
52 tracksRegLiveness: true
59 debugValueSubstitutions:
60 - { srcinst: 2, srcop: 0, dstinst: 1, dstop: 0, subreg: 1 }
61 machineFunctionInfo: {}
67 DBG_INSTR_REF !12, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(2, 0), debug-location !13
\r
68 renamable $rax = MOV64rm $rip, 1, $noreg, target-flags(x86-gotpcrel) @someglobal, $noreg, debug-location !13 :: (load (s64) from got)
69 MOV8mr killed renamable $rax, 1, $noreg, 0, $noreg, renamable $dil, debug-location !13 :: (store (s8) into @someglobal)
70 RET64 debug-location !13