1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
llvm-mirror/test/DebugInfo/Generic/2010-05-10-MultipleCU.ll
Adrian Prantl fb3abba237 [PR27284] Reverse the ownership between DICompileUnit and DISubprogram.
Currently each Function points to a DISubprogram and DISubprogram has a
scope field. For member functions the scope is a DICompositeType. DIScopes
point to the DICompileUnit to facilitate type uniquing.

Distinct DISubprograms (with isDefinition: true) are not part of the type
hierarchy and cannot be uniqued. This change removes the subprograms
list from DICompileUnit and instead adds a pointer to the owning compile
unit to distinct DISubprograms. This would make it easy for ThinLTO to
strip unneeded DISubprograms and their transitively referenced debug info.

Motivation
----------

Materializing DISubprograms is currently the most expensive operation when
doing a ThinLTO build of clang.

We want the DISubprogram to be stored in a separate Bitcode block (or the
same block as the function body) so we can avoid having to expensively
deserialize all DISubprograms together with the global metadata. If a
function has been inlined into another subprogram we need to store a
reference the block containing the inlined subprogram.

Attached to https://llvm.org/bugs/show_bug.cgi?id=27284 is a python script
that updates LLVM IR testcases to the new format.

http://reviews.llvm.org/D19034
<rdar://problem/25256815>

llvm-svn: 266446
2016-04-15 15:57:41 +00:00

45 lines
2.0 KiB
LLVM

; REQUIRES: object-emission
; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
; Check that two compile units are generated
; CHECK: Compile Unit:
; CHECK: Compile Unit:
define i32 @foo() nounwind readnone ssp !dbg !2 {
return:
ret i32 42, !dbg !0
}
define i32 @bar() nounwind readnone ssp !dbg !10 {
return:
ret i32 21, !dbg !8
}
!llvm.dbg.cu = !{!4, !12}
!llvm.module.flags = !{!21}
!16 = !{!2}
!17 = !{!10}
!0 = !DILocation(line: 3, scope: !1)
!1 = distinct !DILexicalBlock(line: 2, column: 0, file: !18, scope: !2)
!2 = distinct !DISubprogram(name: "foo", linkageName: "foo", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !4, file: !18, scope: !3, type: !5)
!3 = !DIFile(filename: "a.c", directory: "/tmp/")
!4 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: false, emissionKind: FullDebug, file: !18, enums: !19, retainedTypes: !19)
!5 = !DISubroutineType(types: !6)
!6 = !{!7}
!7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!8 = !DILocation(line: 3, scope: !9)
!9 = distinct !DILexicalBlock(line: 2, column: 0, file: !20, scope: !10)
!10 = distinct !DISubprogram(name: "bar", linkageName: "bar", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !12, file: !20, scope: !11, type: !13)
!11 = !DIFile(filename: "b.c", directory: "/tmp/")
!12 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: false, emissionKind: FullDebug, file: !20, enums: !19, retainedTypes: !19)
!13 = !DISubroutineType(types: !14)
!14 = !{!15}
!15 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!18 = !DIFile(filename: "a.c", directory: "/tmp/")
!19 = !{}
!20 = !DIFile(filename: "b.c", directory: "/tmp/")
!21 = !{i32 1, !"Debug Info Version", i32 3}