mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-23 12:40:38 +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
25 lines
1.2 KiB
LLVM
25 lines
1.2 KiB
LLVM
; RUN: opt -S -strip-nonlinetable-debuginfo %s -o - | FileCheck %s
|
|
!llvm.dbg.cu = !{!2, !6}
|
|
!llvm.gcov = !{!3}
|
|
!llvm.module.flags = !{!7}
|
|
|
|
!1 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
|
|
; The first CU is used for the line table, the second one is a module skeleton
|
|
; and should be stripped.
|
|
; CHECK: !llvm.dbg.cu = !{![[CU:[0-9]+]]}
|
|
; CHECK: ![[CU]] = distinct !DICompileUnit({{.*}}"abc.debug"{{.*}}LineTablesOnly
|
|
; CHECK-NOT: retainedTypes:
|
|
; CHECK-SAME: )
|
|
; CHECK-NOT: DICompositeType
|
|
!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang",
|
|
isOptimized: true, flags: "-O2", runtimeVersion: 2,
|
|
splitDebugFilename: "abc.debug", emissionKind: FullDebug,
|
|
retainedTypes: !4)
|
|
!3 = !{!"path/to/file.o", !2}
|
|
!4 = !{!5}
|
|
!5 = !DICompositeType(tag: DW_TAG_structure_type, file: !1, identifier: "ThisWillBeStripped")
|
|
!6 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang",
|
|
splitDebugFilename: "abc.dwo", emissionKind: FullDebug,
|
|
dwoId: 1234)
|
|
!7 = !{i32 1, !"Debug Info Version", i32 3}
|