1 # FIXME: Fix machine verifier issues and remove -verify-machineinstrs=0. PR39481.
2 # RUN: llc -mtriple=x86_64-linux-gnu -start-before greedy -stop-after virtregrewriter -o - -verify-machineinstrs=0 %s | FileCheck %s
6 source_filename = "test/DebugInfo/X86/dbg-value-inlined-parameter.ll"
7 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-apple-darwin"
10 %struct.S1 = type { float*, i32 }
12 @p = common global %struct.S1 zeroinitializer, align 8, !dbg !0
14 ; Function Attrs: nounwind optsize ssp
15 define void @foobar() !dbg !15 {
17 tail call void @llvm.dbg.value(metadata %struct.S1* @p, metadata !18, metadata !DIExpression()) , !dbg !25
21 ; Function Attrs: nounwind readnone speculatable
22 declare void @llvm.dbg.value(metadata, metadata, metadata) #2
25 !llvm.module.flags = !{!14}
27 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
28 !1 = !DIGlobalVariable(name: "p", scope: !2, file: !3, line: 14, type: !6, isLocal: false, isDefinition: true)
29 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 2.9 (trunk 125693)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !4, globals: !5, imports: !4)
30 !3 = !DIFile(filename: "nm2.c", directory: "/private/tmp")
33 !6 = !DIDerivedType(tag: DW_TAG_typedef, name: "S1", scope: !2, file: !3, line: 4, baseType: !7)
34 !7 = !DICompositeType(tag: DW_TAG_structure_type, name: "S1", scope: !2, file: !3, line: 1, size: 128, align: 64, elements: !8)
36 !9 = !DIDerivedType(tag: DW_TAG_member, name: "m", scope: !3, file: !3, line: 2, baseType: !10, size: 64, align: 64)
37 !10 = !DIDerivedType(tag: DW_TAG_pointer_type, scope: !2, baseType: !11, size: 64, align: 64)
38 !11 = !DIBasicType(name: "float", size: 32, align: 32, encoding: DW_ATE_float)
39 !12 = !DIDerivedType(tag: DW_TAG_member, name: "nums", scope: !3, file: !3, line: 3, baseType: !13, size: 32, align: 32, offset: 64)
40 !13 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
41 !14 = !{i32 1, !"Debug Info Version", i32 3}
42 !15 = distinct !DISubprogram(name: "foobar", scope: !3, file: !3, line: 15, type: !16, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !2)
43 !16 = !DISubroutineType(types: !17)
45 !18 = !DILocalVariable(name: "sp", arg: 1, scope: !19, file: !3, line: 7, type: !24)
46 !19 = distinct !DISubprogram(name: "foo", scope: !3, file: !3, line: 8, type: !20, isLocal: false, isDefinition: true, scopeLine: 8, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !22)
47 !20 = !DISubroutineType(types: !21)
50 !23 = !DILocalVariable(name: "nums", arg: 2, scope: !19, file: !3, line: 7, type: !13)
51 !24 = !DIDerivedType(tag: DW_TAG_pointer_type, scope: !2, baseType: !6, size: 64, align: 64)
52 !25 = !DILocation(line: 7, column: 13, scope: !19, inlinedAt: !26)
53 !26 = !DILocation(line: 16, column: 3, scope: !27)
54 !27 = distinct !DILexicalBlock(scope: !15, file: !3, line: 15, column: 15)
55 !32 = !DILocation(line: 17, column: 1, scope: !27)
60 tracksRegLiveness: true
63 %1:gr64 = IMPLICIT_DEF
64 %2:gr64 = IMPLICIT_DEF
67 ; This DBG_VALUE will be discarded (use before def of %0).
68 DBG_VALUE %0, $noreg, !18, !DIExpression(), debug-location !25
69 %0:gr64 = IMPLICIT_DEF
70 %0:gr64 = IMPLICIT_DEF
71 %0:gr64 = IMPLICIT_DEF
72 %0:gr64 = IMPLICIT_DEF
75 ; This DBG_VALUE will be discarded (%1 is defined earlier, but it is not live in, so we do not know where %1 is stored).
76 DBG_VALUE %1, $noreg, !18, !DIExpression(), debug-location !25
77 %1:gr64 = IMPLICIT_DEF
78 %1:gr64 = IMPLICIT_DEF
79 %1:gr64 = IMPLICIT_DEF
80 %1:gr64 = IMPLICIT_DEF
81 ; This DBG_VALUE is kept, even if %1 is dead, it was defined in the prev instruction,
82 ; so the value should be available for as long as the register allocated to %1 is live.
83 DBG_VALUE %1, $noreg, !18, !DIExpression(), debug-location !25
86 %1:gr64 = IMPLICIT_DEF
87 DBG_VALUE 0, $noreg, !23, !DIExpression(), debug-location !25
88 ; This DBG_VALUE is kept, even if %1 is dead, it was defined in the prev non-dbg instruction,
89 ; so the value should be available for as long as the register allocated to %1 is live.
90 DBG_VALUE %1, $noreg, !18, !DIExpression(), debug-location !25
93 ; All DBG_VALUEs here should survive. %2 is livein as it was defined in bb.0, and it has use/def in the BTS64ri8 instruction.
94 DBG_VALUE %2, $noreg, !18, !DIExpression(), debug-location !25
95 %2:gr64 = BTS64ri8 %2, 0, implicit-def $eflags
96 DBG_VALUE 0, $noreg, !23, !DIExpression(), debug-location !25
97 DBG_VALUE %2, $noreg, !18, !DIExpression(), debug-location !25
98 %2:gr64 = BTS64ri8 %2, 0, implicit-def $eflags
99 DBG_VALUE %2, $noreg, !18, !DIExpression(), debug-location !25
100 %2:gr64 = BTS64ri8 %2, 0, implicit-def $eflags
101 DBG_VALUE %2, $noreg, !18, !DIExpression(), debug-location !25
104 RET 0, debug-location !32
107 # CHECK-LABEL: name: foobar
110 # CHECK: DBG_VALUE $noreg
113 # CHECK: DBG_VALUE $noreg
114 # CHECK-NEXT: dead renamable $rcx = IMPLICIT_DEF
115 # CHECK-NEXT: dead renamable $rcx = IMPLICIT_DEF
116 # CHECK-NEXT: dead renamable $rcx = IMPLICIT_DEF
117 # CHECK-NEXT: dead renamable $rcx = IMPLICIT_DEF
118 # CHECK-NEXT: DBG_VALUE $rcx, $noreg, !18, !DIExpression()
121 # CHECK: dead renamable $rcx = IMPLICIT_DEF
122 # CHECK-NEXT: DBG_VALUE 0, $noreg, !23, !DIExpression()
123 # CHECK-NEXT: DBG_VALUE $rcx, $noreg, !18, !DIExpression()
126 # CHECK: liveins: $rax
127 # CHECK: DBG_VALUE $rax, $noreg, !18, !DIExpression()
128 # CHECK-NEXT: renamable $rax = BTS64ri8 killed renamable $rax, 0, implicit-def $eflags
129 # CHECK-NEXT: DBG_VALUE 0, $noreg, !23, !DIExpression()
130 # CHECK-NEXT: DBG_VALUE $rax, $noreg, !18, !DIExpression()
131 # CHECK-NEXT: renamable $rax = BTS64ri8 killed renamable $rax, 0, implicit-def $eflags
132 # CHECK-NEXT: DBG_VALUE $rax, $noreg, !18, !DIExpression()
133 # CHECK-NEXT: dead renamable $rax = BTS64ri8 killed renamable $rax, 0, implicit-def $eflags