1; RUN: llc -debug-entry-values %s -o - -filetype=obj \ 2; RUN: | llvm-dwarfdump -verify - | FileCheck %s 3; 4; CHECK: No errors. 5; 6; The source code of the test case: 7; 8;extern int fn1(); 9;extern int fn3(int); 10; 11;__attribute__((noinline)) 12;void 13;fn2 (int *arg) { 14; int a = ++(*arg); 15; fn3 (a); 16;} 17; 18;__attribute__((noinline)) 19;int f() { 20; int x = fn1(); 21; fn2 (&x); 22; return 0; 23;} 24; 25; ModuleID = 'test.c' 26target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 27target triple = "x86_64-unknown-linux-gnu" 28 29; Function Attrs: noinline nounwind uwtable 30define dso_local void @fn2(ptr nocapture %arg) local_unnamed_addr !dbg !15 { 31entry: 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 38 ret void, !dbg !23 39} 40 41; Function Attrs: argmemonly nounwind willreturn 42declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) 43 44declare !dbg !4 dso_local i32 @fn3(i32) local_unnamed_addr 45 46; Function Attrs: argmemonly nounwind willreturn 47declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) 48 49; Function Attrs: noinline nounwind uwtable 50define dso_local i32 @f() local_unnamed_addr !dbg !24 { 51entry: 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 60 ret i32 0, !dbg !29 61} 62 63declare !dbg !8 dso_local i32 @fn1(...) local_unnamed_addr 64 65; Function Attrs: nounwind readnone speculatable willreturn 66declare void @llvm.dbg.value(metadata, metadata, metadata) 67 68!llvm.dbg.cu = !{!0} 69!llvm.module.flags = !{!11, !12, !13} 70!llvm.ident = !{!14} 71 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") 74!2 = !{} 75!3 = !{!4, !8} 76!4 = !DISubprogram(name: "fn3", scope: !1, file: !1, line: 2, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) 77!5 = !DISubroutineType(types: !6) 78!6 = !{!7, !7} 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) 82!10 = !{!7, null} 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) 89!17 = !{null, !18} 90!18 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64) 91!19 = !{!20, !21} 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) 98!26 = !{!7} 99!27 = !{!28} 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) 103