From cfd85505ad819798e01454f0bbd2059b11db33a2 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Mon, 9 May 2016 17:43:30 +0000 Subject: [PATCH] Revert "Allow the LTO code generator to strip invalid debug info from the input." This reverts commit 268936 while investigating buildbot breakage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268940 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/Verifier.h | 14 ++++---------- lib/IR/Verifier.cpp | 10 +++------- lib/LTO/LTOCodeGenerator.cpp | 20 -------------------- test/LTO/X86/Inputs/strip-debug-info.bc | Bin 852 -> 0 bytes test/LTO/X86/strip-debug-info.ll | 20 -------------------- 5 files changed, 7 insertions(+), 57 deletions(-) delete mode 100644 test/LTO/X86/Inputs/strip-debug-info.bc delete mode 100644 test/LTO/X86/strip-debug-info.ll diff --git a/include/llvm/IR/Verifier.h b/include/llvm/IR/Verifier.h index 70bec787a4c..41a47226caf 100644 --- a/include/llvm/IR/Verifier.h +++ b/include/llvm/IR/Verifier.h @@ -41,16 +41,10 @@ bool verifyFunction(const Function &F, raw_ostream *OS = nullptr); /// \brief Check a module for errors. /// -/// If there are no errors, the function returns false. If an error is -/// found, a message describing the error is written to OS (if -/// non-null) and true is returned. -/// -/// \return true if the module is broken. If BrokenDebugInfo is -/// supplied, DebugInfo verification failures won't be considered as -/// error and instead *BrokenDebugInfo will be set to true. Debug -/// info errors can be "recovered" from by stripping the debug info. -bool verifyModule(const Module &M, raw_ostream *OS = nullptr, - bool *BrokenDebugInfo = nullptr); +/// If there are no errors, the function returns false. If an error is found, +/// a message describing the error is written to OS (if non-null) and true is +/// returned. +bool verifyModule(const Module &M, raw_ostream *OS = nullptr); /// \brief Create a verifier pass. /// diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp index e09f763f10b..576aefdf29a 100644 --- a/lib/IR/Verifier.cpp +++ b/lib/IR/Verifier.cpp @@ -4417,22 +4417,18 @@ bool llvm::verifyFunction(const Function &f, raw_ostream *OS) { return !V.verify(F); } -bool llvm::verifyModule(const Module &M, raw_ostream *OS, - bool *BrokenDebugInfo) { +bool llvm::verifyModule(const Module &M, raw_ostream *OS) { // Don't use a raw_null_ostream. Printing IR is expensive. - Verifier V(OS, /*ShouldTreatBrokenDebugInfoAsError=*/!BrokenDebugInfo); + Verifier V(OS, /*ShouldTreatBrokenDebugInfoAsError=*/true); bool Broken = false; for (const Function &F : M) if (!F.isDeclaration() && !F.isMaterializable()) Broken |= !V.verify(F); - Broken |= !V.verify(M); - if (BrokenDebugInfo) - *BrokenDebugInfo = V.hasBrokenDebugInfo(); // Note that this function's return value is inverted from what you would // expect of a function called "verify". - return Broken; + return !V.verify(M) || Broken; } namespace { diff --git a/lib/LTO/LTOCodeGenerator.cpp b/lib/LTO/LTOCodeGenerator.cpp index 0e1c46cff27..226004a3353 100644 --- a/lib/LTO/LTOCodeGenerator.cpp +++ b/lib/LTO/LTOCodeGenerator.cpp @@ -26,7 +26,6 @@ #include "llvm/Config/config.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DataLayout.h" -#include "llvm/IR/DebugInfo.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/DiagnosticPrinter.h" @@ -79,16 +78,6 @@ cl::opt LTODiscardValueNames( cl::init(false), #endif cl::Hidden); - -cl::opt 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); } LTOCodeGenerator::LTOCodeGenerator(LLVMContext &Context) @@ -499,15 +488,6 @@ void LTOCodeGenerator::verifyMergedModuleOnce() { return; HasVerifiedInput = true; - if (LTOStripInvalidDebugInfo) { - bool BrokenDebugInfo = false; - 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"); - StripDebugInfo(*MergedModule); - } - } if (verifyModule(*MergedModule, &dbgs())) report_fatal_error("Broken module found, compilation aborted!"); } diff --git a/test/LTO/X86/Inputs/strip-debug-info.bc b/test/LTO/X86/Inputs/strip-debug-info.bc deleted file mode 100644 index c83195ff9caf593aabee8f82262add183515d758..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 852 zcmXX^duUQo7(eb_cWv6$HDOx!%DH>Qf*#^(X=bFi$0{LL6g~b(W!j=}cV^2~gihD7 zW^r4i{39Zxf*@i&u%ZWTj*@btA}VN&WM&a-j3|0g(AnyP^E)5sJN$m%?>ooFKNw!1 z20#h`a4Ymx_RaSTpT94ev*D;pn!)Fs0)QvDCU1wJ2=8ThQQ^wt)(p9-SYF>=E{d8?=J0@fHn;P|m1d>ZOy{A~UjtCBs|dge4n{2Lx)rjB2Y#f6Jdc za%7wychI$}es-8+UUO`pOXt-eHs6hypYo;~#NxY=#ZkhX9apzHsr^mV!Y1U$7(#-G z1Si#6L$&^pV%ohSv`vOuG{~PoZHe&gv2l9r9sTVAJ*p?%nIw}>GTBKSaxsrNra#O+ zb``%Ac~gcrB_{D!+Stt-V}!XoJr9fiZa2Rm%spwvqa8@tg#1Dz&_o5DD4;=svq(F* zUO5JoUmSE^q(_!2bC4dzE?^Bi)T`^W>Yj7VP*^wgj>+fPPZFJ1(_rl37oConvyQ6& zMx1DGkP6~CU&8aA_-pbKe+~9Q?b{?IcnfZ)hc`V_?6r?qz`s q0)U?$l#!C67MxQ!Uq`Dd8r#n^a9Ji_Z(14?lSPnHbd2EAWc&q8b0o0< diff --git a/test/LTO/X86/strip-debug-info.ll b/test/LTO/X86/strip-debug-info.ll deleted file mode 100644 index 265a34b9c97..00000000000 --- a/test/LTO/X86/strip-debug-info.ll +++ /dev/null @@ -1,20 +0,0 @@ -; RUN: not llvm-lto -lto-strip-invalid-debug-info=false \ -; RUN: -o %t.o %S/Inputs/strip-debug-info.bc 2>&1 | \ -; RUN: FileCheck %s -allow-empty -check-prefix=CHECK-ERR -; RUN: llvm-lto -lto-strip-invalid-debug-info=true -exported-symbol _foo \ -; RUN: -o %t.o %S/Inputs/strip-debug-info.bc 2>&1 | \ -; RUN: FileCheck %s -allow-empty -check-prefix=CHECK-WARN -; RUN: llvm-nm %t.o | FileCheck %s - -; CHECK-ERR: Broken module found, compilation aborted -; CHECK-WARN: Invalid debug info found, debug info will be stripped -; CHECK: foo -define void @foo() { - ret void -} - -!llvm.module.flags = !{!0} -!llvm.dbg.cu = !{!1} - -!0 = !{i32 2, !"Debug Info Version", i32 3} -!1 = !DIFile(filename: "broken", directory: "") -- 2.11.0