1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
llvm-mirror/test/Transforms/StripSymbols/strip-dead-debug-info.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

58 lines
2.6 KiB
LLVM

; RUN: opt -strip-dead-debug-info -verify %s -S | FileCheck %s
; CHECK: ModuleID = '{{.*}}'
; CHECK-NOT: bar
; CHECK-NOT: abcd
@xyz = global i32 2
; Function Attrs: nounwind readnone
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #0
; Function Attrs: nounwind readnone ssp
define i32 @fn() #1 !dbg !6 {
entry:
ret i32 0, !dbg !18
}
; Function Attrs: nounwind readonly ssp
define i32 @foo(i32 %i) #2 !dbg !10 {
entry:
tail call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !15, metadata !DIExpression()), !dbg !20
%.0 = load i32, i32* @xyz, align 4
ret i32 %.0, !dbg !21
}
attributes #0 = { nounwind readnone }
attributes #1 = { nounwind readnone ssp }
attributes #2 = { nounwind readonly ssp }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!25}
!0 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !{}, retainedTypes: !{}, globals: !24)
!1 = !DIFile(filename: "g.c", directory: "/tmp/")
!2 = !{null}
!3 = distinct !DISubprogram(name: "bar", line: 5, isLocal: true, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !0, file: !1, scope: null, type: !4)
!4 = !DISubroutineType(types: !2)
!5 = !DIFile(filename: "g.c", directory: "/tmp/")
!6 = distinct !DISubprogram(name: "fn", linkageName: "fn", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !0, file: !1, scope: null, type: !7)
!7 = !DISubroutineType(types: !8)
!8 = !{!9}
!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!10 = distinct !DISubprogram(name: "foo", linkageName: "foo", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !0, file: !1, scope: null, type: !11)
!11 = !DISubroutineType(types: !12)
!12 = !{!9, !9}
!13 = !DILocalVariable(name: "bb", line: 5, scope: !14, file: !5, type: !9)
!14 = distinct !DILexicalBlock(line: 5, column: 0, file: !1, scope: !3)
!15 = !DILocalVariable(name: "i", line: 7, arg: 1, scope: !10, file: !5, type: !9)
!16 = !DIGlobalVariable(name: "abcd", line: 2, isLocal: true, isDefinition: true, scope: !5, file: !5, type: !9)
!17 = !DIGlobalVariable(name: "xyz", line: 3, isLocal: false, isDefinition: true, scope: !5, file: !5, type: !9, variable: i32* @xyz)
!18 = !DILocation(line: 6, scope: !19)
!19 = distinct !DILexicalBlock(line: 6, column: 0, file: !1, scope: !6)
!20 = !DILocation(line: 7, scope: !10)
!21 = !DILocation(line: 10, scope: !22)
!22 = distinct !DILexicalBlock(line: 7, column: 0, file: !1, scope: !10)
!24 = !{!16, !17}
!25 = !{i32 1, !"Debug Info Version", i32 3}