Add -strip-nonlinetable-debuginfo capability
authorMichael Ilseman <milseman@apple.com>
Thu, 6 Oct 2016 17:58:38 +0000 (17:58 +0000)
committerMichael Ilseman <milseman@apple.com>
Thu, 6 Oct 2016 17:58:38 +0000 (17:58 +0000)
commitd0a4db76324e40e38a23429c07eda76f9f26a153
tree6ac35853dca1ba748f529745839c8d0e84ef4a16
parent9a605f93a7e070b8a4a70043dc21825d9ced1e96
Add -strip-nonlinetable-debuginfo capability

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.

llvm-svn: 283473
14 files changed:
llvm/include/llvm/IR/DebugInfo.h
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/Transforms/IPO.h
llvm/lib/IR/DebugInfo.cpp
llvm/lib/Transforms/Utils/CMakeLists.txt
llvm/lib/Transforms/Utils/StripNonLineTableDebugInfo.cpp [new file with mode: 0644]
llvm/lib/Transforms/Utils/Utils.cpp
llvm/test/BugPoint/metadata.ll
llvm/test/BugPoint/named-md.ll
llvm/test/Transforms/Util/strip-nonlinetable-debuginfo.ll [new file with mode: 0644]
llvm/test/Transforms/Util/strip-nonlinetable-debuginfo2.ll [new file with mode: 0644]
llvm/test/Transforms/Util/strip-nonlinetable-debuginfo3.ll [new file with mode: 0644]
llvm/test/Transforms/Util/strip-nonlinetable-debuginfo4.ll [new file with mode: 0644]
llvm/tools/bugpoint/CrashDebugger.cpp