• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=x86_64-unknown-unknown -start-after=codegenprepare -stop-before finalize-isel %s -o -  | FileCheck %s
2
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.
5
6; CHECK:       ![[AAAVAR:.*]] = !DILocalVariable(name: "aaa",
7; CHECK-LABEL: bb.1.next:
8; CHECK:       DBG_VALUE %{{[0-9]+}}, $noreg, ![[AAAVAR]]
9
10target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
11target triple = "x86_64-linux-gnu"
12
13define i8 @f(i32* %foo) local_unnamed_addr !dbg !6 {
14entry:
15  %bar = getelementptr i32, i32* %foo, i32 4
16  %baz = bitcast i32* %bar to i8*
17  %quux = load i8, i8* %baz
18  br label %next
19
20next:                                             ; preds = %entry
21  tail call void @llvm.dbg.value(metadata i8* %baz, metadata !15, metadata !DIExpression()), !dbg !30
22  %xyzzy = add i8 %quux, 123
23  br label %fin
24
25fin:                                              ; preds = %next
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
30  ret i8 %ret
31}
32
33; Function Attrs: nounwind readnone speculatable
34declare void @llvm.dbg.value(metadata, metadata, metadata) #0
35
36attributes #0 = { nounwind readnone speculatable }
37
38!llvm.dbg.cu = !{!0}
39!llvm.module.flags = !{!25, !26, !27, !28}
40!llvm.ident = !{!29}
41
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: ".")
44!2 = !{}
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)
47!8 = !{!13}
48!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_unsigned)
49!14 = !{!15}
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}
55!29 = !{!"clang"}
56!30 = !DILocation(line: 18, column: 14, scope: !6)
57