57 lines · plain
1; RUN: llc -split-dwarf-file=foo.dwo %s -filetype=obj -o - | llvm-dwarfdump -debug-info - | FileCheck %s2 3; Created from:4; a.cpp:5; void f1();6; inline __attribute__((always_inline)) __attribute__((used)) void f2() { f1(); }7; b.cpp:8; void f2();9; void f3() {10; f2();11; }12; $ clang++ -fno-split-dwarf-inlining {a,b}.cpp -emit-llvm -S -g13; $ llvm-link {a,b}.ll -S -o ab.ll14; Then strip out the @llvm.used global, so no out of line definition of 'f2'15; will be emitted. This emulates something more like the available_externally16; import performed by ThinLTO.17 18; CHECK: .debug_info contents:19; CHECK: Compile Unit20; CHECK-NOT: Compile Unit21; CHECK: .debug_info.dwo contents:22 23target triple = "x86_64-pc-linux"24 25declare void @_Z2f1v()26 27; Function Attrs: noinline norecurse uwtable28define i32 @main() !dbg !9 {29entry:30 call void @_Z2f1v(), !dbg !1331 ret i32 0, !dbg !1832}33 34!llvm.dbg.cu = !{!0, !3}35!llvm.ident = !{!5, !5}36!llvm.module.flags = !{!6, !7, !8}37 38!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 304054) (llvm/trunk 304080)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false)39!1 = !DIFile(filename: "a.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")40!2 = !{}41!3 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !4, producer: "clang version 5.0.0 (trunk 304054) (llvm/trunk 304080)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false)42!4 = !DIFile(filename: "b.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")43!5 = !{!"clang version 5.0.0 (trunk 304054) (llvm/trunk 304080)"}44!6 = !{i32 2, !"Dwarf Version", i32 4}45!7 = !{i32 2, !"Debug Info Version", i32 3}46!8 = !{i32 1, !"wchar_size", i32 4}47!9 = distinct !DISubprogram(name: "main", scope: !4, file: !4, line: 2, type: !10, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !3, retainedNodes: !2)48!10 = !DISubroutineType(types: !11)49!11 = !{!12}50!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)51!13 = !DILocation(line: 2, column: 73, scope: !14, inlinedAt: !17)52!14 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2v", scope: !1, file: !1, line: 2, type: !15, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)53!15 = !DISubroutineType(types: !16)54!16 = !{null}55!17 = distinct !DILocation(line: 3, column: 3, scope: !9)56!18 = !DILocation(line: 4, column: 1, scope: !9)57