1; Test to ensure only the necessary DICompileUnit fields are imported 2; for ThinLTO 3 4; RUN: opt -module-summary %s -o %t1.bc 5; RUN: opt -module-summary %p/Inputs/debuginfo-cu-import.ll -o %t2.bc 6; RUN: llvm-lto -thinlto-action=thinlink -o %t.index.bc %t1.bc %t2.bc 7 8; Don't import enums, macros, retainedTypes, globals or imports lists. 9; RUN: llvm-lto -thinlto-action=import %t2.bc -thinlto-index=%t.index.bc -o - | llvm-dis -o - | FileCheck %s 10; CHECK-NOT: DICompileUnit{{.*}} enums: 11; CHECK-NOT: DICompileUnit{{.*}} macros: 12; CHECK-NOT: DICompileUnit{{.*}} retainedTypes: 13; CHECK-NOT: DICompileUnit{{.*}} globals: 14; CHECK-NOT: DICompileUnit{{.*}} imports: 15 16;; Repeat test in RemoveDIs debug-info mode to check that bitcode is loaded and 17;; converted correctly. 18; RUN: llvm-lto -thinlto-action=import %t2.bc -thinlto-index=%t.index.bc -o - --try-experimental-debuginfo-iterators | llvm-dis -o - | FileCheck %s 19 20; ModuleID = 'debuginfo-cu-import.c' 21source_filename = "debuginfo-cu-import.c" 22target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 23target triple = "x86_64-unknown-linux-gnu" 24 25define void @foo() !dbg !28 { 26entry: 27 ret void, !dbg !29 28} 29 30define void @_ZN1A1aEv() !dbg !13 { 31entry: 32 ret void, !dbg !30 33} 34 35define internal void @_ZN1A1bEv() !dbg !31 { 36entry: 37 ret void, !dbg !32 38} 39 40!llvm.dbg.cu = !{!0} 41!llvm.module.flags = !{!25, !26} 42!llvm.ident = !{!27} 43 44!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 4.0.0 (trunk 286863) (llvm/trunk 286875)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !6, globals: !8, imports: !11, macros: !21) 45!1 = !DIFile(filename: "a2.cc", directory: "") 46!2 = !{!3} 47!3 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "enum1", scope: !4, file: !1, line: 50, size: 32, elements: !5, identifier: "_ZTSN9__gnu_cxx12_Lock_policyE") 48!4 = !DINamespace(name: "A", scope: null) 49!5 = !{} 50!6 = !{!7} 51!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "Base", file: !1, line: 1, size: 32, align: 32, elements: !5, identifier: "_ZTS4Base") 52!8 = !{!9} 53!9 = !DIGlobalVariableExpression(var: !10, expr: !DIExpression()) 54!10 = !DIGlobalVariable(name: "version", scope: !4, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true) 55!11 = !{!12} 56!12 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !4, entity: !13, file: !1, line: 8) 57!13 = distinct !DISubprogram(name: "a", linkageName: "_ZN1A1aEv", scope: !4, file: !1, line: 7, type: !14, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !5) 58!14 = !DISubroutineType(types: !15) 59!15 = !{null} 60!16 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !17, entity: !19, file: !1, line: 8) 61!17 = distinct !DILexicalBlock(scope: !18, file: !1, line: 9, column: 8) 62!18 = distinct !DISubprogram(name: "c", linkageName: "_ZN1A1cEv", scope: !4, file: !1, line: 9, type: !14, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !33) 63!19 = distinct !DILexicalBlock(scope: !20, file: !1, line: 10, column: 8) 64!20 = distinct !DISubprogram(name: "d", linkageName: "_ZN1A1dEv", scope: !4, file: !1, line: 10, type: !14, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !5) 65!21 = !{!22} 66!22 = !DIMacroFile(file: !1, nodes: !23) 67!23 = !{!24} 68!24 = !DIMacro(type: DW_MACINFO_define, line: 3, name: "X", value: "5") 69!25 = !{i32 2, !"Dwarf Version", i32 4} 70!26 = !{i32 2, !"Debug Info Version", i32 3} 71!27 = !{!"clang version 4.0.0 (trunk 286863) (llvm/trunk 286875)"} 72!28 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !14, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0, retainedNodes: !5) 73!29 = !DILocation(line: 3, column: 1, scope: !28) 74!30 = !DILocation(line: 7, column: 12, scope: !13) 75!31 = distinct !DISubprogram(name: "b", linkageName: "_ZN1A1bEv", scope: !4, file: !1, line: 8, type: !14, isLocal: true, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !5) 76!32 = !DILocation(line: 8, column: 24, scope: !31) 77!33 = !{!16} 78