mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-02 16:56:50 +00:00
5bd98bf7d6
This adds a new function to DebugInfo.cpp that takes an llvm::Module as input and removes all debug info metadata that is not directly needed for line tables, thus effectively stripping all type and variable information from the module. The primary motivation for this feature was the bitcode work flow (cf. http://lists.llvm.org/pipermail/llvm-dev/2016-June/100643.html for more background). This is not wired up yet, but will be in subsequent patches. For testing, the new functionality is exposed to opt with a -strip-nonlinetable-debuginfo option. The secondary use-case (and one that works right now!) is as a reduction pass in bugpoint. I added two new bugpoint options (-disable-strip-debuginfo and -disable-strip-debug-types) to control the new features. By default it will first attempt to remove all debug information, then only the type info, and then proceed to hack at any remaining MDNodes. Thanks to Adrian Prantl for stewarding this patch! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285094 91177308-0d34-0410-b5e6-96231b3b80d8
37 lines
1.5 KiB
LLVM
37 lines
1.5 KiB
LLVM
; RUN: opt -S -strip-nonlinetable-debuginfo %s -o - | FileCheck %s
|
|
; CHECK: define void @f() !dbg ![[F:[0-9]+]]
|
|
define void @f() !dbg !4 {
|
|
entry:
|
|
%i = alloca i32, align 4
|
|
; CHECK-NOT: llvm.dbg.declare
|
|
call void @llvm.dbg.declare(metadata i32* %i, metadata !11, metadata !13), !dbg !14
|
|
store i32 42, i32* %i, align 4, !dbg !14
|
|
ret void, !dbg !15
|
|
}
|
|
|
|
; Function Attrs: nounwind readnone
|
|
declare void @llvm.dbg.declare(metadata, metadata, metadata)
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
!llvm.module.flags = !{!7, !8, !9}
|
|
!llvm.ident = !{!10}
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "LLVM", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2)
|
|
!1 = !DIFile(filename: "f.c", directory: "/")
|
|
!2 = !{}
|
|
; CHECK: ![[F]] = distinct !DISubprogram(name: "f"
|
|
; CHECK-NOT: variables:
|
|
; CHECK-NOT: distinct !DISubprogram(name: "f"
|
|
!4 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, unit: !0, variables: !2)
|
|
!5 = !DISubroutineType(types: !6)
|
|
!6 = !{null}
|
|
!7 = !{i32 2, !"Dwarf Version", i32 2}
|
|
!8 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!9 = !{i32 1, !"PIC Level", i32 2}
|
|
!10 = !{!"LLVM"}
|
|
!11 = !DILocalVariable(name: "i", scope: !4, file: !1, line: 1, type: !12)
|
|
!12 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
|
!13 = !DIExpression()
|
|
!14 = !DILocation(line: 1, column: 16, scope: !4)
|
|
!15 = !DILocation(line: 1, column: 24, scope: !4)
|