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