2016-12-13 00:09:30 +08:00
|
|
|
; Test to ensure only the necessary DICompileUnit fields are imported
|
|
|
|
; for ThinLTO
|
|
|
|
|
|
|
|
; RUN: opt -module-summary %s -o %t1.bc
|
|
|
|
; RUN: opt -module-summary %p/Inputs/debuginfo-cu-import.ll -o %t2.bc
|
|
|
|
; RUN: llvm-lto -thinlto-action=thinlink -o %t.index.bc %t1.bc %t2.bc
|
|
|
|
|
|
|
|
; Don't import enums, macros, retainedTypes or globals lists.
|
|
|
|
; Only import local scope imported entities.
|
|
|
|
; RUN: llvm-lto -thinlto-action=import %t2.bc -thinlto-index=%t.index.bc -o - | llvm-dis -o - | FileCheck %s
|
|
|
|
; CHECK-NOT: DICompileUnit{{.*}} enums:
|
|
|
|
; CHECK-NOT: DICompileUnit{{.*}} macros:
|
|
|
|
; CHECK-NOT: DICompileUnit{{.*}} retainedTypes:
|
|
|
|
; CHECK-NOT: DICompileUnit{{.*}} globals:
|
|
|
|
; CHECK: DICompileUnit{{.*}} imports: ![[IMP:[0-9]+]]
|
|
|
|
; CHECK: ![[IMP]] = !{!{{[0-9]+}}}
|
|
|
|
|
|
|
|
; ModuleID = 'debuginfo-cu-import.c'
|
|
|
|
source_filename = "debuginfo-cu-import.c"
|
2019-09-11 07:15:38 +08:00
|
|
|
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
2016-12-13 00:09:30 +08:00
|
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
define void @foo() !dbg !28 {
|
2016-12-13 00:09:30 +08:00
|
|
|
entry:
|
2016-12-22 08:45:21 +08:00
|
|
|
ret void, !dbg !29
|
2016-12-13 00:09:30 +08:00
|
|
|
}
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
define void @_ZN1A1aEv() !dbg !13 {
|
2016-12-13 00:09:30 +08:00
|
|
|
entry:
|
2016-12-22 08:45:21 +08:00
|
|
|
ret void, !dbg !30
|
2016-12-13 00:09:30 +08:00
|
|
|
}
|
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
define internal void @_ZN1A1bEv() !dbg !31 {
|
2016-12-13 00:09:30 +08:00
|
|
|
entry:
|
2016-12-22 08:45:21 +08:00
|
|
|
ret void, !dbg !32
|
2016-12-13 00:09:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
2016-12-22 08:45:21 +08:00
|
|
|
!llvm.module.flags = !{!25, !26}
|
|
|
|
!llvm.ident = !{!27}
|
2016-12-13 00:09:30 +08:00
|
|
|
|
2016-12-22 08:45:21 +08:00
|
|
|
!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)
|
2016-12-13 00:09:30 +08:00
|
|
|
!1 = !DIFile(filename: "a2.cc", directory: "")
|
2016-12-22 08:45:21 +08:00
|
|
|
!2 = !{!3}
|
|
|
|
!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")
|
2017-04-29 06:25:46 +08:00
|
|
|
!4 = !DINamespace(name: "A", scope: null)
|
2016-12-22 08:45:21 +08:00
|
|
|
!5 = !{}
|
|
|
|
!6 = !{!7}
|
|
|
|
!7 = !DICompositeType(tag: DW_TAG_structure_type, name: "Base", file: !1, line: 1, size: 32, align: 32, elements: !5, identifier: "_ZTS4Base")
|
|
|
|
!8 = !{!9}
|
2017-08-31 02:06:51 +08:00
|
|
|
!9 = !DIGlobalVariableExpression(var: !10, expr: !DIExpression())
|
2016-12-22 08:45:21 +08:00
|
|
|
!10 = !DIGlobalVariable(name: "version", scope: !4, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true)
|
|
|
|
!11 = !{!12, !16}
|
2017-07-19 08:09:54 +08:00
|
|
|
!12 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !4, entity: !13, file: !1, line: 8)
|
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
|
|
|
!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)
|
2016-12-22 08:45:21 +08:00
|
|
|
!14 = !DISubroutineType(types: !15)
|
|
|
|
!15 = !{null}
|
2017-07-19 08:09:54 +08:00
|
|
|
!16 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !17, entity: !19, file: !1, line: 8)
|
2016-12-13 00:09:30 +08:00
|
|
|
!17 = distinct !DILexicalBlock(scope: !18, file: !1, line: 9, column: 8)
|
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
|
|
|
!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: !5)
|
2016-12-13 00:09:30 +08:00
|
|
|
!19 = distinct !DILexicalBlock(scope: !20, file: !1, line: 10, column: 8)
|
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
|
|
|
!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)
|
2016-12-22 08:45:21 +08:00
|
|
|
!21 = !{!22}
|
|
|
|
!22 = !DIMacroFile(file: !1, nodes: !23)
|
|
|
|
!23 = !{!24}
|
|
|
|
!24 = !DIMacro(type: DW_MACINFO_define, line: 3, name: "X", value: "5")
|
|
|
|
!25 = !{i32 2, !"Dwarf Version", i32 4}
|
|
|
|
!26 = !{i32 2, !"Debug Info Version", i32 3}
|
|
|
|
!27 = !{!"clang version 4.0.0 (trunk 286863) (llvm/trunk 286875)"}
|
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
|
|
|
!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)
|
2016-12-22 08:45:21 +08:00
|
|
|
!29 = !DILocation(line: 3, column: 1, scope: !28)
|
|
|
|
!30 = !DILocation(line: 7, column: 12, scope: !13)
|
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
|
|
|
!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)
|
2016-12-22 08:45:21 +08:00
|
|
|
!32 = !DILocation(line: 8, column: 24, scope: !31)
|
|
|
|
|