diff options
author | Adrian Prantl <aprantl@apple.com> | 2017-10-02 18:31:29 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2017-10-02 18:31:29 +0000 |
commit | 733fe2f23133cccdd7bac660abd76577b0589081 (patch) | |
tree | 001487e93e5b65a1aa873a535b50696fed02eea9 /lib/LTO | |
parent | fc20547ae6d3528a850caf7438d4c276ab47b3be (diff) |
Move the stripping of invalid debug info from the Verifier to AutoUpgrade.
This came out of a recent discussion on llvm-dev
(https://reviews.llvm.org/D38042). Currently the Verifier will strip
the debug info metadata from a module if it finds the dbeug info to be
malformed. This feature is very valuable since it allows us to improve
the Verifier by making it stricter without breaking bcompatibility,
but arguable the Verifier pass should not be modifying the IR. This
patch moves the stripping of broken debug info into AutoUpgrade
(UpgradeDebugInfo to be precise), which is a much better location for
this since the stripping of malformed (i.e., produced by older, buggy
versions of Clang) is a (harsh) form of AutoUpgrade.
This change is mostly NFC in nature, the one big difference is the
behavior when LLVM module passes are introducing malformed debug
info. Prior to this patch, a NoAsserts build would have printed a
warning and stripped the debug info, after this patch the Verifier
will report a fatal error. I believe this behavior is actually more
desirable anyway.
Differential Revision: https://reviews.llvm.org/D38184
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/LTO')
-rw-r--r-- | lib/LTO/LTOCodeGenerator.cpp | 13 | ||||
-rw-r--r-- | lib/LTO/ThinLTOCodeGenerator.cpp | 4 |
2 files changed, 2 insertions, 15 deletions
diff --git a/lib/LTO/LTOCodeGenerator.cpp b/lib/LTO/LTOCodeGenerator.cpp index 0e6c3edb140..9693a7c254c 100644 --- a/lib/LTO/LTOCodeGenerator.cpp +++ b/lib/LTO/LTOCodeGenerator.cpp @@ -83,16 +83,6 @@ cl::opt<bool> LTODiscardValueNames( #endif cl::Hidden); -cl::opt<bool> LTOStripInvalidDebugInfo( - "lto-strip-invalid-debug-info", - cl::desc("Strip invalid debug info metadata during LTO instead of aborting."), -#ifdef NDEBUG - cl::init(true), -#else - cl::init(false), -#endif - cl::Hidden); - cl::opt<std::string> LTORemarksFilename("lto-pass-remarks-output", cl::desc("Output filename for pass remarks"), @@ -495,8 +485,7 @@ void LTOCodeGenerator::verifyMergedModuleOnce() { HasVerifiedInput = true; bool BrokenDebugInfo = false; - if (verifyModule(*MergedModule, &dbgs(), - LTOStripInvalidDebugInfo ? &BrokenDebugInfo : nullptr)) + if (verifyModule(*MergedModule, &dbgs(), &BrokenDebugInfo)) report_fatal_error("Broken module found, compilation aborted!"); if (BrokenDebugInfo) { emitWarning("Invalid debug info found, debug info will be stripped"); diff --git a/lib/LTO/ThinLTOCodeGenerator.cpp b/lib/LTO/ThinLTOCodeGenerator.cpp index ffd78dad922..c8b3892375f 100644 --- a/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/lib/LTO/ThinLTOCodeGenerator.cpp @@ -63,7 +63,6 @@ namespace llvm { extern cl::opt<bool> LTODiscardValueNames; extern cl::opt<std::string> LTORemarksFilename; extern cl::opt<bool> LTOPassRemarksWithHotness; -extern cl::opt<bool> LTOStripInvalidDebugInfo; } namespace { @@ -158,8 +157,7 @@ public: /// Verify the module and strip broken debug info. static void verifyLoadedModule(Module &TheModule) { bool BrokenDebugInfo = false; - if (verifyModule(TheModule, &dbgs(), - LTOStripInvalidDebugInfo ? &BrokenDebugInfo : nullptr)) + if (verifyModule(TheModule, &dbgs(), &BrokenDebugInfo)) report_fatal_error("Broken module found, compilation aborted!"); if (BrokenDebugInfo) { TheModule.getContext().diagnose(ThinLTODiagnosticInfo( |