1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-25 22:12:57 +02:00
llvm-mirror/test/DebugInfo/Generic/debuginfofinder-multiple-cu.ll
Peter Collingbourne 5b721561aa DI: Reverse direction of subprogram -> function edge.
Previously, subprograms contained a metadata reference to the function they
described. Because most clients need to get or set a subprogram for a given
function rather than the other way around, this created unneeded inefficiency.

For example, many passes needed to call the function llvm::makeSubprogramMap()
to build a mapping from functions to subprograms, and the IR linker needed to
fix up function references in a way that caused quadratic complexity in the IR
linking phase of LTO.

This change reverses the direction of the edge by storing the subprogram as
function-level metadata and removing DISubprogram's function field.

Since this is an IR change, a bitcode upgrade has been provided.

Fixes PR23367. An upgrade script for textual IR for out-of-tree clients is
attached to the PR.

Differential Revision: http://reviews.llvm.org/D14265

llvm-svn: 252219
2015-11-05 22:03:56 +00:00

42 lines
1.8 KiB
LLVM

; RUN: opt -analyze -module-debuginfo < %s | FileCheck %s
; Produced from linking:
; /tmp/test1.c containing f()
; /tmp/test2.c containing g()
; Verify that both compile units and both their contained functions are
; listed by DebugInfoFinder:
;CHECK: Compile unit: DW_LANG_C99 from /tmp/test1.c
;CHECK: Compile unit: DW_LANG_C99 from /tmp/test2.c
;CHECK: Subprogram: f from /tmp/test1.c:1
;CHECK: Subprogram: g from /tmp/test2.c:1
define void @f() !dbg !4 {
ret void, !dbg !14
}
define void @g() !dbg !11 {
ret void, !dbg !15
}
!llvm.dbg.cu = !{!0, !8}
!llvm.module.flags = !{!13, !16}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.4 (192092)", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2)
!1 = !DIFile(filename: "test1.c", directory: "/tmp")
!2 = !{}
!3 = !{!4}
!4 = distinct !DISubprogram(name: "f", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 1, file: !1, scope: !5, type: !6, variables: !2)
!5 = !DIFile(filename: "test1.c", directory: "/tmp")
!6 = !DISubroutineType(types: !7)
!7 = !{null}
!8 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.4 (192092)", isOptimized: false, emissionKind: 0, file: !9, enums: !2, retainedTypes: !2, subprograms: !10, globals: !2, imports: !2)
!9 = !DIFile(filename: "test2.c", directory: "/tmp")
!10 = !{!11}
!11 = distinct !DISubprogram(name: "g", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 1, file: !9, scope: !12, type: !6, variables: !2)
!12 = !DIFile(filename: "test2.c", directory: "/tmp")
!13 = !{i32 2, !"Dwarf Version", i32 4}
!14 = !DILocation(line: 1, scope: !4)
!15 = !DILocation(line: 1, scope: !11)
!16 = !{i32 1, !"Debug Info Version", i32 3}