1 ; RUN: llc -mtriple=x86_64-unknown-unknown -start-after=codegenprepare \
2 ; RUN: -stop-before finalize-isel %s -o - \
3 ; RUN: -experimental-debug-variable-locations=false \
4 ; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE
5 ; RUN: llc -mtriple=x86_64-unknown-unknown -start-after=codegenprepare \
6 ; RUN: -stop-before finalize-isel %s -o - \
7 ; RUN: -experimental-debug-variable-locations=true \
8 ; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF
10 ; Test that the dbg.value for %baz, which doesn't exist in the 'next' bb,
11 ; can be salvaged back to the underlying argument vreg.
13 ; CHECK: ![[AAAVAR:.*]] = !DILocalVariable(name: "aaa",
14 ; CHECK-LABEL: bb.0.entry:
15 ; INSTRREF: DBG_PHI $rdi, 1
16 ; CHECK-LABEL: bb.1.next:
17 ; INSTRREF: DBG_INSTR_REF ![[AAAVAR]], {{.+}}, dbg-instr-ref(1, 0)
\r
18 ; DBGVALUE: DBG_VALUE %{{[0-9]+}}, $noreg, ![[AAAVAR]]
20 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
21 target triple = "x86_64-linux-gnu"
23 define i8 @f(ptr %foo) local_unnamed_addr !dbg !6 {
25 %bar = getelementptr i32, ptr %foo, i32 4
26 %quux = load i8, ptr %bar
29 next: ; preds = %entry
30 tail call void @llvm.dbg.value(metadata ptr %bar, metadata !15, metadata !DIExpression()), !dbg !30
31 %xyzzy = add i8 %quux, 123
35 %trains = getelementptr i32, ptr %foo, i32 3
36 %cars = load i8, ptr %trains
37 %ret = add i8 %xyzzy, %cars
41 ; Function Attrs: nounwind readnone speculatable
42 declare void @llvm.dbg.value(metadata, metadata, metadata) #0
44 attributes #0 = { nounwind readnone speculatable }
47 !llvm.module.flags = !{!25, !26, !27, !28}
50 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
51 !1 = !DIFile(filename: "test.c", directory: ".")
53 !6 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 18, type: !7, scopeLine: 19, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14)
54 !7 = !DISubroutineType(types: !8)
56 !13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_unsigned)
58 !15 = !DILocalVariable(name: "aaa", scope: !6, file: !1, line: 18, type: !13)
59 !25 = !{i32 2, !"Dwarf Version", i32 4}
60 !26 = !{i32 2, !"Debug Info Version", i32 3}
61 !27 = !{i32 1, !"wchar_size", i32 4}
62 !28 = !{i32 7, !"PIC Level", i32 2}
64 !30 = !DILocation(line: 18, column: 14, scope: !6)