1 ; RUN: llc -debug-entry-values %s -o - -filetype=obj \
2 ; RUN: | llvm-dwarfdump -verify - | FileCheck %s
6 ; The source code of the test case:
11 ;__attribute__((noinline))
18 ;__attribute__((noinline))
26 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
27 target triple = "x86_64-unknown-linux-gnu"
29 ; Function Attrs: noinline nounwind uwtable
30 define dso_local void @fn2(ptr nocapture %arg) local_unnamed_addr !dbg !15 {
32 call void @llvm.dbg.value(metadata ptr %arg, metadata !20, metadata !DIExpression()), !dbg !22
33 %0 = load i32, ptr %arg, align 4, !dbg !23
34 %inc = add nsw i32 %0, 1, !dbg !23
35 store i32 %inc, ptr %arg, align 4, !dbg !23
36 call void @llvm.dbg.value(metadata i32 %inc, metadata !21, metadata !DIExpression()), !dbg !22
37 %call = tail call i32 @fn3(i32 %inc), !dbg !23
41 ; Function Attrs: argmemonly nounwind willreturn
42 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)
44 declare !dbg !4 dso_local i32 @fn3(i32) local_unnamed_addr
46 ; Function Attrs: argmemonly nounwind willreturn
47 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)
49 ; Function Attrs: noinline nounwind uwtable
50 define dso_local i32 @f() local_unnamed_addr !dbg !24 {
52 %x = alloca i32, align 4
53 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x), !dbg !29
54 %call = tail call i32 (...) @fn1() #4, !dbg !29
55 call void @llvm.dbg.value(metadata i32 %call, metadata !28, metadata !DIExpression()), !dbg !30
56 store i32 %call, ptr %x, align 4, !dbg !29
57 call void @llvm.dbg.value(metadata ptr %x, metadata !28, metadata !DIExpression(DW_OP_deref)), !dbg !30
58 call void @fn2(ptr nonnull %x), !dbg !29
59 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x), !dbg !29
63 declare !dbg !8 dso_local i32 @fn1(...) local_unnamed_addr
65 ; Function Attrs: nounwind readnone speculatable willreturn
66 declare void @llvm.dbg.value(metadata, metadata, metadata)
69 !llvm.module.flags = !{!11, !12, !13}
72 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)
73 !1 = !DIFile(filename: "test.c", directory: "dir")
76 !4 = !DISubprogram(name: "fn3", scope: !1, file: !1, line: 2, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
77 !5 = !DISubroutineType(types: !6)
79 !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
80 !8 = !DISubprogram(name: "fn1", scope: !1, file: !1, line: 1, type: !9, spFlags: DISPFlagOptimized, retainedNodes: !2)
81 !9 = !DISubroutineType(types: !10)
83 !11 = !{i32 2, !"Dwarf Version", i32 4}
84 !12 = !{i32 2, !"Debug Info Version", i32 3}
85 !13 = !{i32 1, !"wchar_size", i32 4}
86 !14 = !{!"clang version 10.0.0"}
87 !15 = distinct !DISubprogram(name: "fn2", scope: !1, file: !1, line: 6, type: !16, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !19)
88 !16 = !DISubroutineType(types: !17)
90 !18 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64)
92 !20 = !DILocalVariable(name: "arg", arg: 1, scope: !15, file: !1, line: 6, type: !18)
93 !21 = !DILocalVariable(name: "a", scope: !15, file: !1, line: 7, type: !7)
94 !22 = !DILocation(line: 0, scope: !15)
95 !23 = !DILocation(line: 7, column: 11, scope: !15)
96 !24 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 12, type: !25, scopeLine: 12, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !27)
97 !25 = !DISubroutineType(types: !17)
100 !28 = !DILocalVariable(name: "x", scope: !24, file: !1, line: 13, type: !7)
101 !29 = !DILocation(line: 13, column: 3, scope: !24)
102 !30 = !DILocation(line: 0, scope: !24)