]> granicus.if.org Git - llvm/commitdiff
Move the stripping of invalid debug info from the Verifier to AutoUpgrade.
authorAdrian Prantl <aprantl@apple.com>
Mon, 2 Oct 2017 18:31:29 +0000 (18:31 +0000)
committerAdrian Prantl <aprantl@apple.com>
Mon, 2 Oct 2017 18:31:29 +0000 (18:31 +0000)
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

46 files changed:
include/llvm/AsmParser/Parser.h
include/llvm/IRReader/IRReader.h
lib/AsmParser/LLParser.cpp
lib/AsmParser/LLParser.h
lib/AsmParser/Parser.cpp
lib/IR/AutoUpgrade.cpp
lib/IR/DebugInfo.cpp
lib/IR/Metadata.cpp
lib/IR/Verifier.cpp
lib/IRReader/IRReader.cpp
lib/LTO/LTOCodeGenerator.cpp
lib/LTO/ThinLTOCodeGenerator.cpp
test/Analysis/GlobalsModRef/pr12351.ll
test/DebugInfo/Generic/invalid.ll
test/DebugInfo/Generic/location-verifier.ll
test/DebugInfo/Generic/piece-verifier.ll
test/DebugInfo/pr34186.ll
test/DebugInfo/pr34672.ll
test/LTO/X86/strip-debug-info-no-call-loc.ll
test/LTO/X86/strip-debug-info.ll
test/Verifier/DILocation-parents.ll
test/Verifier/DISubprogram.ll
test/Verifier/callsite-dbgloc.ll
test/Verifier/dbg-difile-crash.ll
test/Verifier/dbg-invalid-compileunit.ll
test/Verifier/dbg-invalid-named-metadata.ll
test/Verifier/dbg-invalid-retaintypes.ll
test/Verifier/dbg-line-without-file.ll
test/Verifier/dbg-null-retained-type.ll
test/Verifier/dbg.ll
test/Verifier/diglobalvariable.ll
test/Verifier/fnarg-debuginfo.ll
test/Verifier/fragment.ll
test/Verifier/func-dbg.ll
test/Verifier/llvm.dbg.declare-address.ll
test/Verifier/llvm.dbg.declare-expression.ll
test/Verifier/llvm.dbg.declare-variable.ll
test/Verifier/llvm.dbg.value-expression.ll
test/Verifier/llvm.dbg.value-value.ll
test/Verifier/llvm.dbg.value-variable.ll
test/Verifier/metadata-function-dbg.ll
test/Verifier/pr34325.ll
test/Verifier/tbaa.ll
tools/llvm-as/llvm-as.cpp
tools/opt/opt.cpp
unittests/IR/VerifierTest.cpp

index 768b089b8a2a693ac3e08d714800f7feab9cfa0f..5f02e488e5b1b1524a8ef59a82a42797ad3dceed 100644 (file)
@@ -36,10 +36,12 @@ class Type;
 /// \param Context Context in which to allocate globals info.
 /// \param Slots The optional slot mapping that will be initialized during
 ///              parsing.
-std::unique_ptr<Module> parseAssemblyFile(StringRef Filename,
-                                          SMDiagnostic &Error,
-                                          LLVMContext &Context,
-                                          SlotMapping *Slots = nullptr);
+/// \param UpgradeDebugInfo Run UpgradeDebugInfo, which runs the Verifier.
+///                         This option should only be set to false by llvm-as
+///                         for use inside the LLVM testuite!
+std::unique_ptr<Module>
+parseAssemblyFile(StringRef Filename, SMDiagnostic &Error, LLVMContext &Context,
+                  SlotMapping *Slots = nullptr, bool UpgradeDebugInfo = true);
 
 /// The function is a secondary interface to the LLVM Assembly Parser. It parses
 /// an ASCII string that (presumably) contains LLVM Assembly code. It returns a
@@ -52,10 +54,14 @@ std::unique_ptr<Module> parseAssemblyFile(StringRef Filename,
 /// \param Context Context in which to allocate globals info.
 /// \param Slots The optional slot mapping that will be initialized during
 ///              parsing.
+/// \param UpgradeDebugInfo Run UpgradeDebugInfo, which runs the Verifier.
+///                         This option should only be set to false by llvm-as
+///                         for use inside the LLVM testuite!
 std::unique_ptr<Module> parseAssemblyString(StringRef AsmString,
                                             SMDiagnostic &Error,
                                             LLVMContext &Context,
-                                            SlotMapping *Slots = nullptr);
+                                            SlotMapping *Slots = nullptr,
+                                            bool UpgradeDebugInfo = true);
 
 /// parseAssemblyFile and parseAssemblyString are wrappers around this function.
 /// \brief Parse LLVM Assembly from a MemoryBuffer.
@@ -63,9 +69,13 @@ std::unique_ptr<Module> parseAssemblyString(StringRef AsmString,
 /// \param Err Error result info.
 /// \param Slots The optional slot mapping that will be initialized during
 ///              parsing.
+/// \param UpgradeDebugInfo Run UpgradeDebugInfo, which runs the Verifier.
+///                         This option should only be set to false by llvm-as
+///                         for use inside the LLVM testuite!
 std::unique_ptr<Module> parseAssembly(MemoryBufferRef F, SMDiagnostic &Err,
                                       LLVMContext &Context,
-                                      SlotMapping *Slots = nullptr);
+                                      SlotMapping *Slots = nullptr,
+                                      bool UpgradeDebugInfo = true);
 
 /// This function is the low-level interface to the LLVM Assembly Parser.
 /// This is kept as an independent function instead of being inlined into
@@ -78,8 +88,12 @@ std::unique_ptr<Module> parseAssembly(MemoryBufferRef F, SMDiagnostic &Err,
 /// \param Slots The optional slot mapping that will be initialized during
 ///              parsing.
 /// \return true on error.
+/// \param UpgradeDebugInfo Run UpgradeDebugInfo, which runs the Verifier.
+///                         This option should only be set to false by llvm-as
+///                         for use inside the LLVM testuite!
 bool parseAssemblyInto(MemoryBufferRef F, Module &M, SMDiagnostic &Err,
-                       SlotMapping *Slots = nullptr);
+                       SlotMapping *Slots = nullptr,
+                       bool UpgradeDebugInfo = true);
 
 /// Parse a type and a constant value in the given string.
 ///
index 7b24ec11fb64659306fff2899316409e6e2c3482..f5621647db06989f473b39b106c2cce3b74d2e01 100644 (file)
@@ -37,14 +37,22 @@ getLazyIRFileModule(StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
 /// If the given MemoryBuffer holds a bitcode image, return a Module
 /// for it.  Otherwise, attempt to parse it as LLVM Assembly and return
 /// a Module for it.
+/// \param UpgradeDebugInfo Run UpgradeDebugInfo, which runs the Verifier.
+///                         This option should only be set to false by llvm-as
+///                         for use inside the LLVM testuite!
 std::unique_ptr<Module> parseIR(MemoryBufferRef Buffer, SMDiagnostic &Err,
-                                LLVMContext &Context);
+                                LLVMContext &Context,
+                                bool UpgradeDebugInfo = true);
 
 /// If the given file holds a bitcode image, return a Module for it.
 /// Otherwise, attempt to parse it as LLVM Assembly and return a Module
 /// for it.
+/// \param UpgradeDebugInfo Run UpgradeDebugInfo, which runs the Verifier.
+///                         This option should only be set to false by llvm-as
+///                         for use inside the LLVM testuite!
 std::unique_ptr<Module> parseIRFile(StringRef Filename, SMDiagnostic &Err,
-                                    LLVMContext &Context);
+                                    LLVMContext &Context,
+                                    bool UpgradeDebugInfo = true);
 }
 
 #endif
index 9ae5ff1f6ef5961eeba996009e3c2e70d58eca10..4dc5d81cd088f401e268f6579a0de09f243fe6c1 100644 (file)
@@ -237,7 +237,8 @@ bool LLParser::ValidateEndOfModule() {
     }
   }
 
-  UpgradeDebugInfo(*M);
+  if (UpgradeDebugInfo)
+    llvm::UpgradeDebugInfo(*M);
 
   UpgradeModuleFlags(*M);
 
index d5b059355c423381bc09de9d37e351ffc0cd0900..5dadf521538cd938a470db8883d8c54b5b93d2eb 100644 (file)
@@ -139,11 +139,16 @@ namespace llvm {
     std::map<Value*, std::vector<unsigned> > ForwardRefAttrGroups;
     std::map<unsigned, AttrBuilder> NumberedAttrBuilders;
 
+    /// Only the llvm-as tool may set this to false to bypass
+    /// UpgradeDebuginfo so it can generate broken bitcode.
+    bool UpgradeDebugInfo;
+
   public:
     LLParser(StringRef F, SourceMgr &SM, SMDiagnostic &Err, Module *M,
-             SlotMapping *Slots = nullptr)
+             SlotMapping *Slots = nullptr, bool UpgradeDebugInfo = true)
         : Context(M->getContext()), Lex(F, SM, Err, M->getContext()), M(M),
-          Slots(Slots), BlockAddressPFS(nullptr) {}
+          Slots(Slots), BlockAddressPFS(nullptr),
+          UpgradeDebugInfo(UpgradeDebugInfo) {}
     bool Run();
 
     bool parseStandaloneConstantValue(Constant *&C, const SlotMapping *Slots);
index bee07ad9e0a52949c88a585a2a50dcaf338b0cb4..a43ae2b5577ab5e33e03752e7f0aa145409110ad 100644 (file)
 using namespace llvm;
 
 bool llvm::parseAssemblyInto(MemoryBufferRef F, Module &M, SMDiagnostic &Err,
-                             SlotMapping *Slots) {
+                             SlotMapping *Slots, bool UpgradeDebugInfo) {
   SourceMgr SM;
   std::unique_ptr<MemoryBuffer> Buf = MemoryBuffer::getMemBuffer(F);
   SM.AddNewSourceBuffer(std::move(Buf), SMLoc());
 
-  return LLParser(F.getBuffer(), SM, Err, &M, Slots).Run();
+  return LLParser(F.getBuffer(), SM, Err, &M, Slots, UpgradeDebugInfo).Run();
 }
 
-std::unique_ptr<Module> llvm::parseAssembly(MemoryBufferRef F,
-                                            SMDiagnostic &Err,
-                                            LLVMContext &Context,
-                                            SlotMapping *Slots) {
+std::unique_ptr<Module>
+llvm::parseAssembly(MemoryBufferRef F, SMDiagnostic &Err, LLVMContext &Context,
+                    SlotMapping *Slots, bool UpgradeDebugInfo) {
   std::unique_ptr<Module> M =
       make_unique<Module>(F.getBufferIdentifier(), Context);
 
-  if (parseAssemblyInto(F, *M, Err, Slots))
+  if (parseAssemblyInto(F, *M, Err, Slots, UpgradeDebugInfo))
     return nullptr;
 
   return M;
@@ -47,7 +46,8 @@ std::unique_ptr<Module> llvm::parseAssembly(MemoryBufferRef F,
 std::unique_ptr<Module> llvm::parseAssemblyFile(StringRef Filename,
                                                 SMDiagnostic &Err,
                                                 LLVMContext &Context,
-                                                SlotMapping *Slots) {
+                                                SlotMapping *Slots,
+                                                bool UpgradeDebugInfo) {
   ErrorOr<std::unique_ptr<MemoryBuffer>> FileOrErr =
       MemoryBuffer::getFileOrSTDIN(Filename);
   if (std::error_code EC = FileOrErr.getError()) {
@@ -56,15 +56,17 @@ std::unique_ptr<Module> llvm::parseAssemblyFile(StringRef Filename,
     return nullptr;
   }
 
-  return parseAssembly(FileOrErr.get()->getMemBufferRef(), Err, Context, Slots);
+  return parseAssembly(FileOrErr.get()->getMemBufferRef(), Err, Context, Slots,
+                       UpgradeDebugInfo);
 }
 
 std::unique_ptr<Module> llvm::parseAssemblyString(StringRef AsmString,
                                                   SMDiagnostic &Err,
                                                   LLVMContext &Context,
-                                                  SlotMapping *Slots) {
+                                                  SlotMapping *Slots,
+                                                  bool UpgradeDebugInfo) {
   MemoryBufferRef F(AsmString, "<string>");
-  return parseAssembly(F, Err, Context, Slots);
+  return parseAssembly(F, Err, Context, Slots, UpgradeDebugInfo);
 }
 
 Constant *llvm::parseConstantValue(StringRef Asm, SMDiagnostic &Err,
index 2a69912671e83f05feb0e414df7874e5c3e034e7..e190b201ccc16f7e5f275914fe71c28cac941ca5 100644 (file)
@@ -27,6 +27,7 @@
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/Verifier.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Regex.h"
 #include <cstring>
@@ -2358,15 +2359,26 @@ Value *llvm::UpgradeBitCastExpr(unsigned Opc, Constant *C, Type *DestTy) {
 /// info. Return true if module is modified.
 bool llvm::UpgradeDebugInfo(Module &M) {
   unsigned Version = getDebugMetadataVersionFromModule(M);
-  if (Version == DEBUG_METADATA_VERSION)
-    return false;
-
-  bool RetCode = StripDebugInfo(M);
-  if (RetCode) {
+  if (Version == DEBUG_METADATA_VERSION) {
+    bool BrokenDebugInfo = false;
+    if (verifyModule(M, &llvm::errs(), &BrokenDebugInfo))
+      report_fatal_error("Broken module found, compilation aborted!");
+    if (!BrokenDebugInfo)
+      // Everything is ok.
+      return false;
+    else {
+      // Diagnose malformed debug info.
+      DiagnosticInfoIgnoringInvalidDebugMetadata Diag(M);
+      M.getContext().diagnose(Diag);
+    }
+  }
+  bool Modified = StripDebugInfo(M);
+  if (Modified && Version != DEBUG_METADATA_VERSION) {
+    // Diagnose a version mismatch.
     DiagnosticInfoDebugMetadataVersion DiagVersion(M, Version);
     M.getContext().diagnose(DiagVersion);
   }
-  return RetCode;
+  return Modified;
 }
 
 bool llvm::UpgradeModuleFlags(Module &M) {
index 289798648b526bd6a5eae81cf64acbedf170798b..ae044b3d28728bdeb80c56e163e05f2645c1f3fa 100644 (file)
@@ -290,7 +290,7 @@ static MDNode *stripDebugLocFromLoopID(MDNode *N) {
 
 bool llvm::stripDebugInfo(Function &F) {
   bool Changed = false;
-  if (F.getSubprogram()) {
+  if (F.getMetadata(LLVMContext::MD_dbg)) {
     Changed = true;
     F.setSubprogram(nullptr);
   }
index ac02ff76c843670b04d426c54102b096ed90429a..a148ab65fc83077b6e0892dd4eab94324b4c0d88 100644 (file)
@@ -1431,7 +1431,6 @@ void GlobalObject::setMetadata(StringRef Kind, MDNode *N) {
 MDNode *GlobalObject::getMetadata(unsigned KindID) const {
   SmallVector<MDNode *, 1> MDs;
   getMetadata(KindID, MDs);
-  assert(MDs.size() <= 1 && "Expected at most one metadata attachment");
   if (MDs.empty())
     return nullptr;
   return MDs[0];
index 57559356f4d316915a8d5951a86ebf5d02d07502..7c6e4585b9ed1fe8abb3df21d3365a48e7553038 100644 (file)
@@ -4684,19 +4684,8 @@ struct VerifierLegacyPass : public FunctionPass {
         HasErrors |= !V->verify(F);
 
     HasErrors |= !V->verify();
-    if (FatalErrors) {
-      if (HasErrors)
-        report_fatal_error("Broken module found, compilation aborted!");
-      assert(!V->hasBrokenDebugInfo() && "Module contains invalid debug info");
-    }
-
-    // Strip broken debug info.
-    if (V->hasBrokenDebugInfo()) {
-      DiagnosticInfoIgnoringInvalidDebugMetadata DiagInvalid(M);
-      M.getContext().diagnose(DiagInvalid);
-      if (!StripDebugInfo(M))
-        report_fatal_error("Failed to strip malformed debug info");
-    }
+    if (FatalErrors && (HasErrors || V->hasBrokenDebugInfo()))
+      report_fatal_error("Broken module found, compilation aborted!");
     return false;
   }
 
@@ -4999,19 +4988,9 @@ VerifierAnalysis::Result VerifierAnalysis::run(Function &F,
 
 PreservedAnalyses VerifierPass::run(Module &M, ModuleAnalysisManager &AM) {
   auto Res = AM.getResult<VerifierAnalysis>(M);
-  if (FatalErrors) {
-    if (Res.IRBroken)
-      report_fatal_error("Broken module found, compilation aborted!");
-    assert(!Res.DebugInfoBroken && "Module contains invalid debug info");
-  }
+  if (FatalErrors && (Res.IRBroken || Res.DebugInfoBroken))
+    report_fatal_error("Broken module found, compilation aborted!");
 
-  // Strip broken debug info.
-  if (Res.DebugInfoBroken) {
-    DiagnosticInfoIgnoringInvalidDebugMetadata DiagInvalid(M);
-    M.getContext().diagnose(DiagInvalid);
-    if (!StripDebugInfo(M))
-      report_fatal_error("Failed to strip malformed debug info");
-  }
   return PreservedAnalyses::all();
 }
 
index ba587ced71821170fb8710625d8404e2e33e9a51..c4ba659fd0587142cfa89341a6c59933c812dcd7 100644 (file)
@@ -68,7 +68,8 @@ std::unique_ptr<Module> llvm::getLazyIRFileModule(StringRef Filename,
 }
 
 std::unique_ptr<Module> llvm::parseIR(MemoryBufferRef Buffer, SMDiagnostic &Err,
-                                      LLVMContext &Context) {
+                                      LLVMContext &Context,
+                                      bool UpgradeDebugInfo) {
   NamedRegionTimer T(TimeIRParsingName, TimeIRParsingDescription,
                      TimeIRParsingGroupName, TimeIRParsingGroupDescription,
                      TimePassesIsEnabled);
@@ -86,11 +87,12 @@ std::unique_ptr<Module> llvm::parseIR(MemoryBufferRef Buffer, SMDiagnostic &Err,
     return std::move(ModuleOrErr.get());
   }
 
-  return parseAssembly(Buffer, Err, Context);
+  return parseAssembly(Buffer, Err, Context, nullptr, UpgradeDebugInfo);
 }
 
 std::unique_ptr<Module> llvm::parseIRFile(StringRef Filename, SMDiagnostic &Err,
-                                          LLVMContext &Context) {
+                                          LLVMContext &Context,
+                                          bool UpgradeDebugInfo) {
   ErrorOr<std::unique_ptr<MemoryBuffer>> FileOrErr =
       MemoryBuffer::getFileOrSTDIN(Filename);
   if (std::error_code EC = FileOrErr.getError()) {
@@ -99,7 +101,8 @@ std::unique_ptr<Module> llvm::parseIRFile(StringRef Filename, SMDiagnostic &Err,
     return nullptr;
   }
 
-  return parseIR(FileOrErr.get()->getMemBufferRef(), Err, Context);
+  return parseIR(FileOrErr.get()->getMemBufferRef(), Err, Context,
+                 UpgradeDebugInfo);
 }
 
 //===----------------------------------------------------------------------===//
index 0e6c3edb140f7f23555c355bd57b419dafcfba26..9693a7c254c9c0d74a56362557e259277ff53816 100644 (file)
@@ -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");
index ffd78dad9228cb4c8bf1f5e25ee02189f2ae1955..c8b3892375f64251f17bdfaf31d5227853633f9c 100644 (file)
@@ -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(
index 5d299cd2e917072e345f79503f526c4bb780aabd..5cabd6f1f12022d0b8a7422518dd29567b889876 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: opt < %s -basicaa -globals-aa -gvn -S | FileCheck %s
+; RUN: opt < %s -basicaa -globals-aa -gvn -S -disable-verify | FileCheck %s
 
 declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
 define void @foo(i8* %x, i8* %y) {
index fdb68d9cca3f1bb9399e33285867f6ca25d1b24e..9bf9e6374fc9b54641662a56c8cea323b5ed5b5a 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: not opt -verify %s 2>&1 | FileCheck %s
+; RUN: llvm-as -disable-output %s 2>&1 | FileCheck %s
 
 ; Make sure we emit this diagnostic only once (which means we don't visit the
 ; same DISubprogram twice.
@@ -6,6 +6,7 @@
 ; CHECK-NEXT: !3 = distinct !DISubprogram(name: "patatino", scope: null, isLocal: false, isDefinition: true, isOptimized: false)
 ; CHECK-NOT: subprogram definitions must have a compile unit
 ; CHECK-NOT: !3 = distinct !DISubprogram(name: "patatino", scope: null, isLocal: false, isDefinition: true, isOptimized: false)
+; CHECK: warning: ignoring invalid debug info
 
 define void @tinkywinky() !dbg !3 { ret void }
 
index 3decb7c9f17ab0ea6442b92b174b66ad983d0a93..b1e0805428c6f89b1d01c3c3bbbf7eb25ad4e001 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: not llvm-as -disable-output -verify-debug-info < %s 2>&1 | FileCheck %s
+; RUN: llvm-as -disable-output -verify-debug-info -o - < %s 2>&1 | FileCheck %s
 ; ModuleID = 'test.c'
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.10.0"
@@ -30,3 +30,4 @@ attributes #0 = { nounwind ssp uwtable }
 ; An old-style DILocation should not pass verify.
 ; CHECK: invalid !dbg metadata attachment
 !13 = !{i32 2, i32 2, !4, null}
+; CHECK: warning: ignoring invalid debug info
index e692e51a703aef4063a896f4e20eec5c9e87f0de..f7a53f229156241e6759f1bb0f2503d54839a7b1 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: not llvm-as -disable-output < %s 2>&1 | FileCheck %s
+; RUN: llvm-as -disable-output < %s 2>&1 | FileCheck %s
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.9.0"
 
@@ -53,3 +53,4 @@ attributes #1 = { nounwind readnone }
 ; CHECK-NEXT: !DIExpression({{[0-9]+}}, 64, 32, {{[0-9]+}})
 ; CHECK-NOT: invalid expression
 !27 = !DIExpression(DW_OP_LLVM_fragment, 64, 32, DW_OP_deref)
+; CHECK: warning: ignoring invalid debug info
index 4432a278e51c2d7a7839d3adf32b1e1cfadf68a1..36dc5c41acea23d4c9ac32c0d86873a25b3ad7ca 100644 (file)
@@ -5,9 +5,11 @@
 ; alternative is that of keeping a map of visited GVs, which has non trivial
 ; memory usage consequences on large testcases, or when LTO is the mode of
 ; operation.
-; RUN: not llc %s 2>&1 | FileCheck %s
+; RUN: llvm-as -disable-output %s -o - 2>&1 | FileCheck %s
 ; CHECK: missing global variable type
 ; CHECK: missing global variable type
+; CHECK-NOT: missing global variable type
+; CHECK: warning: ignoring invalid debug info
 
 !llvm.dbg.cu = !{!2}
 !llvm.module.flags = !{!63, !64}
index 49be0e3351c4fb041f3c26e8184fe5b2c9499cc3..c944a11fc409d72eb7570528a945a5112323192d 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: not opt -verify %s 2>&1 | FileCheck %s
+; RUN: opt -verify %s 2>&1 | FileCheck %s
 ; CHECK: invalid type ref
 ; CHECK-NOT: invalid type ref
 
index 39b8c40c3a4765ec6d3ba6ee7946affccfe009f4..4a684b276b710e167aa2b5b4694cf01ac23dab45 100644 (file)
@@ -1,6 +1,5 @@
 ; RUN: llvm-as %s -disable-verify -o %t.bc
-; RUN: llvm-lto -lto-strip-invalid-debug-info=true \
-; RUN:     -exported-symbol f -exported-symbol _f \
+; RUN: llvm-lto -exported-symbol f -exported-symbol _f \
 ; RUN:     -o %t.o %t.bc 2>&1 | \
 ; RUN:     FileCheck %s -allow-empty -check-prefix=CHECK-WARN
 ; RUN: llvm-nm %t.o | FileCheck %s 
@@ -8,7 +7,7 @@
 ; Check that missing debug locations on inlinable calls are a
 ; recoverable error.
 
-; CHECK-WARN: Invalid debug info found, debug info will be stripped
+; CHECK-WARN: warning{{.*}} ignoring invalid debug info
 ; CHECK: {{f$}}
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx"
index 6b774516444681048c97100fe19b11988f37b374..f8db5a15fe9afcf0998e889090d0d89a9fd42b05 100644 (file)
@@ -1,52 +1,32 @@
 ; RUN: llvm-as -disable-verify %s -o %t.bc
 ; ---- Full LTO ---------------------------------------------
-; RUN: not llvm-lto -lto-strip-invalid-debug-info=false \
-; RUN:     -o %t.o %t.bc 2>&1 | \
-; RUN:     FileCheck %s -allow-empty -check-prefix=CHECK-ERR
-; RUN: llvm-lto -lto-strip-invalid-debug-info=true \
+; RUN: llvm-lto \
 ; RUN:     -exported-symbol foo -exported-symbol _foo \
 ; RUN:     -o %t.o %t.bc 2>&1 | \
 ; RUN:     FileCheck %s -allow-empty -check-prefix=CHECK-WARN
 ; RUN: llvm-nm %t.o | FileCheck %s 
 ; ---- Thin LTO (codegen only) ------------------------------
-; RUN: not llvm-lto -thinlto -thinlto-action=codegen \
-; RUN:     -lto-strip-invalid-debug-info=false \
-; RUN:     %t.bc -disable-verify 2>&1 | \
-; RUN:     FileCheck %s -allow-empty -check-prefix=CHECK-ERR
 ; RUN: llvm-lto -thinlto -thinlto-action=codegen \
-; RUN:     -lto-strip-invalid-debug-info=true \
 ; RUN:     %t.bc -disable-verify 2>&1 | \
 ; RUN:     FileCheck %s -allow-empty -check-prefix=CHECK-WARN
 ; ---- Thin LTO (optimize, strip main file) -----------------
 ; RUN: opt -disable-verify -module-summary %s -o %t.bc
 ; RUN: opt -disable-verify -module-summary %S/Inputs/strip-debug-info-bar.ll \
 ; RUN:     -o %t2.bc
-; RUN: not llvm-lto -thinlto -thinlto-action=run \
-; RUN:     -lto-strip-invalid-debug-info=false \
-; RUN:     %t.bc -disable-verify 2>&1 | \
-; RUN:     FileCheck %s -allow-empty -check-prefix=CHECK-ERR
 ; RUN: llvm-lto -thinlto -thinlto-action=run \
-; RUN:     -lto-strip-invalid-debug-info=true \
 ; RUN:     %t.bc -disable-verify 2>&1 | \
 ; RUN:     FileCheck %s -allow-empty -check-prefix=CHECK-WARN
 ; ---- Thin LTO (optimize, strip imported file) -------------
 ; RUN: opt -disable-verify -strip-debug -module-summary %t.bc -o %t-stripped.bc
 ; RUN: llvm-lto -thinlto-action=thinlink -o %t.index.bc %t-stripped.bc %t2.bc
-; RUN: not llvm-lto -thinlto -thinlto-action=import \
-; RUN:     -thinlto-index=%t.index.bc \
-; RUN:     -lto-strip-invalid-debug-info=false \
-; RUN:     -exported-symbol foo -exported-symbol _foo \
-; RUN:     %t-stripped.bc -disable-verify 2>&1 | \
-; RUN:     FileCheck %s -allow-empty -check-prefix=CHECK-ERR
 ; RUN: llvm-lto -thinlto -thinlto-action=import \
-; RUN:     -lto-strip-invalid-debug-info=true \
 ; RUN:     -thinlto-index=%t.index.bc \
 ; RUN:     -exported-symbol foo -exported-symbol _foo \
 ; RUN:     %t-stripped.bc -disable-verify 2>&1 | \
 ; RUN:     FileCheck %s -allow-empty -check-prefix=CHECK-WARN
 
 ; CHECK-ERR: Broken module found, compilation aborted
-; CHECK-WARN: Invalid debug info found, debug info will be stripped
+; CHECK-WARN: warning{{.*}} ignoring invalid debug info
 ; CHECK-WARN-NOT: Broken module found
 ; CHECK: foo
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
index 810d0f64c58e8cac72039826866ebd773e18aa46..3490a5fae3ade19c328595617cd38809e4975727 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: not llvm-as %s -o - 2>&1 | FileCheck %s
+; RUN: llvm-as -disable-output %s -o - 2>&1 | FileCheck %s
 source_filename = "t.c"
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.12.0"
@@ -17,6 +17,8 @@ entry:
   ret void, !dbg !9
 }
 
+; CHECK: warning: ignoring invalid debug info
+
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!2, !3}
 
index e78220c8bd785ec107d3e1a6f5c14bc79d1063e4..fd23effe9a8531453fcf01f31fed3f0d174eaf6b 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: not opt -S <%s 2>&1| FileCheck %s
+; RUN: llvm-as -disable-output <%s 2>&1| FileCheck %s
 
 define void @f() !dbg !14 {
   ret void
@@ -12,6 +12,7 @@ define void @f() !dbg !14 {
 !8 = distinct !DICompileUnit(language: DW_LANG_Swift, producer: "clang",
                              file: !2, emissionKind: 2)
 ; CHECK: invalid thrown type
+; CHECK: warning: ignoring invalid debug info
 !13 = !{!14}
 !14 = distinct !DISubprogram(name: "f", scope: !1,
                             file: !2, line: 1, type: !3, isLocal: true,
index 2e7473917ec33deeb1842581769da76fdd1abf89..25fc6cbaab6aa7d9fd799ea001a3fcecd9e42e1f 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: not llvm-as %s -o %t 2>&1 | FileCheck %s
+; RUN: llvm-as %s -o %t 2>&1 | FileCheck %s
 ; Created and then edited from
 ;   extern void i();
 ;   void h() { i(); }
@@ -39,6 +39,8 @@ entry:
 
 attributes #0 = { nounwind ssp uwtable }
 
+; CHECK: warning: ignoring invalid debug info
+
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!3, !4, !5}
 !llvm.ident = !{!6}
index 626d1d1edd35d8deeef1dacb1cb0e1a6dae8adcf..bb57f6128d331c654424aaddb0e3dbd1f60f9135 100644 (file)
@@ -1,6 +1,6 @@
-; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
-; CHECK:      assembly parsed, but does not verify
-; CHECK-NEXT: invalid file
+; RUN: llvm-as -disable-output <%s 2>&1 | FileCheck %s
+; CHECK: invalid file
+; CHECK: warning: ignoring invalid debug info
 
 define void @blah() !dbg !3 {
   ret void
index 8f8a3d975f7b3325ab38c9c1a8f586978c90f0ee..97b4ee3ce24bc731b60244080adb8e42dc95d11d 100644 (file)
@@ -1,5 +1,5 @@
-; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
-; CHECK:      assembly parsed, but does not verify
+; RUN: llvm-as -disable-output <%s 2>&1 | FileCheck %s
+; CHECK: warning: ignoring invalid debug info
 
 !llvm.module.flags = !{!0}
 !llvm.dbg.cu = !{!1}
index d31e0da580748d0b20417c5ac824e55ff68cd8a1..a592e7db4bd7b7337fbf1596019f55c1856e6d10 100644 (file)
@@ -1,5 +1,5 @@
-; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
-; CHECK:      assembly parsed, but does not verify
+; RUN: llvm-as -disable-output <%s 2>&1 | FileCheck %s
+; CHECK: warning: ignoring invalid debug info
 
 !llvm.module.flags = !{!0}
 !llvm.dbg.the_dbg_namespace_is_reserved = !{}
index 3bb69a79eb42aca4898d4a9e7aff838f755b5427..87484ba3faa0d1dbc0cd518e310d3f8f9695d7c8 100644 (file)
@@ -1,5 +1,5 @@
-; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
-; CHECK:      assembly parsed, but does not verify
+; RUN: llvm-as -disable-output <%s 2>&1 | FileCheck %s
+; CHECK: warning: ignoring invalid debug info
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!3}
index 4d5725959ef1484cfd48d9e0d8a0c14de0473663..9cc052911f65caedce0f6d42a584c38a53f77507 100644 (file)
@@ -1,6 +1,6 @@
-; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
-; CHECK: assembly parsed, but does not verify
+; RUN: llvm-as -disable-output <%s 2>&1 | FileCheck %s
 ; CHECK: line specified with no file
+; CHECK: warning: ignoring invalid debug info
 
 define void @foo() !dbg !3 {
   ret void
index f0368c8c48773daad6395d573bf4a0270e6aa516..1e3565d5ae3d33ebf27cf0bd3d7ea0b9eca3c240 100644 (file)
@@ -1,6 +1,6 @@
-; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
-; CHECK:      assembly parsed, but does not verify
-; CHECK-NEXT: invalid retained type
+; RUN: llvm-as -disable-output <%s 2>&1 | FileCheck %s
+; CHECK: invalid retained type
+; CHECK: warning: ignoring invalid debug info
 
 !llvm.module.flags = !{!0}
 !0 = !{i32 2, !"Debug Info Version", i32 3}
index d5728a4e827292093e24b14721700c8d0578e5f2..32c46587070bb7a7962b913fee1ec2fadbad1e27 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
+; RUN: llvm-as -disable-output <%s 2>&1 | FileCheck %s
 
 define void @foo() {
 entry:
@@ -14,6 +14,7 @@ exit:
 ; CHECK-NEXT: ![[LOC]] = !{}
 }
 
+; CHECK: warning: ignoring invalid debug info
 !llvm.module.flags = !{!0}
 !0 = !{i32 2, !"Debug Info Version", i32 3}
 !1 = distinct !DISubprogram()
index 3b5b79d7f34cacc6e631e6384587c8d188fc119c..cc09c17540d36a8510eb02c1e479301fc964cc94 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: not opt -S <%s 2>&1| FileCheck %s
+; RUN: llvm-as -disable-output <%s 2>&1| FileCheck %s
 
 ; CHECK: !dbg attachment of global variable must be a DIGlobalVariableExpression
 @g = common global i32 0, align 4, !dbg !0
@@ -12,3 +12,4 @@
 !5 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
 !6 = !{i32 2, !"Dwarf Version", i32 4}
 !7 = !{i32 2, !"Debug Info Version", i32 3}
+; CHECK: warning: ignoring invalid debug info
index 7cbe9ce93b974de25f230ca13427a0c3eee285c3..f1072e20722775fcdf57e6329d709b941b48eaec 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
+; RUN: llvm-as -disable-output < %s -o /dev/null 2>&1 | FileCheck %s
 
 declare void @llvm.dbg.declare(metadata, metadata, metadata) 
 declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
@@ -12,6 +12,8 @@ entry:
   ret void, !dbg !6
 }
 
+; CHECK: warning: ignoring invalid debug info
+
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!7, !8}
 
index ed5df89cb317d4709d5e8e5fdec8a77133fb9b31..45921a4bd147bddc17a0a8b086f26b0253ec6aca 100644 (file)
@@ -1,9 +1,10 @@
-; RUN: not opt -S <%s 2>&1| FileCheck %s
+; RUN: llvm-as -disable-output <%s 2>&1| FileCheck %s
 
 ; CHECK: fragment is larger than or outside of variable
 ; CHECK: !DIGlobalVariableExpression(var: ![[VAR:[0-9]+]],
 ; CHECK-SAME:                        expr: !DIExpression(DW_OP_LLVM_fragment, 0, 64))
 ; CHECK: ![[VAR]] = !DIGlobalVariable(name: "g"
+; CHECK: warning: ignoring invalid debug info
 
 @g = common global i32 0, align 4, !dbg !0
 
index b05d255d82ec415ac0105f18b0cfcbcdfbe99def..e6518a4a41ea6d7a84489b7d7aadc3a06b3768eb 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
+; RUN: llvm-as -disable-output < %s -o /dev/null 2>&1 | FileCheck %s
 
 define i32 @foo() !dbg !4 {
 entry:
@@ -11,6 +11,7 @@ entry:
   ret i32 0, !dbg !6
 }
 
+; CHECK: warning: ignoring invalid debug info
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!7, !8}
 
index 90cf72aea681990f37370551f4f138ac6ca493ef..219f9ca0a6679b4f414022e47925b7c3929656ea 100644 (file)
@@ -1,7 +1,8 @@
-; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
+; RUN: llvm-as -disable-output <%s 2>&1 | FileCheck %s
 ; CHECK: invalid llvm.dbg.declare intrinsic address/value
 ; CHECK-NEXT: call void @llvm.dbg.declare({{.*}})
 ; CHECK-NEXT: !""
+; CHECK: warning: ignoring invalid debug info
 
 define void @foo(i32 %a) {
 entry:
index 54ee1f750d4abff19b18484f1c153ac7323d9497..24b1f3ed2b9855c9f513d3f04c7b06e3c2c81847 100644 (file)
@@ -1,7 +1,8 @@
-; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
+; RUN: llvm-as -disable-output <%s 2>&1 | FileCheck %s
 ; CHECK: invalid llvm.dbg.declare intrinsic expression
 ; CHECK-NEXT: call void @llvm.dbg.declare({{.*}})
 ; CHECK-NEXT: !""
+; CHECK: warning: ignoring invalid debug info
 
 define void @foo(i32 %a) {
 entry:
index 6f415b7c1fa035df9be58452f7aca38f9ddefc78..a24ed6c92301e93771b37ad70e462c6b23154fd0 100644 (file)
@@ -1,7 +1,8 @@
-; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
+; RUN: llvm-as -disable-output <%s 2>&1 | FileCheck %s
 ; CHECK: invalid llvm.dbg.declare intrinsic variable
 ; CHECK-NEXT: call void @llvm.dbg.declare({{.*}})
 ; CHECK-NEXT: !""
+; CHECK: warning: ignoring invalid debug info
 
 define void @foo(i32 %a) {
 entry:
index dd3c29f91073efefb4a54e609b91bfb49ffcfbd1..e1a68c7e82f1f7af8045eae9c7b590d6c5e7e647 100644 (file)
@@ -1,7 +1,8 @@
-; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
+; RUN: llvm-as -disable-output <%s 2>&1 | FileCheck %s
 ; CHECK: invalid llvm.dbg.value intrinsic expression
 ; CHECK-NEXT: call void @llvm.dbg.value({{.*}})
 ; CHECK-NEXT: !""
+; CHECK: warning: ignoring invalid debug info
 
 define void @foo(i32 %a) {
 entry:
index e1d02de484c63c57a7aaa96de994dfd2ec83e4a1..8b0ec1fed05c312bde89fa73c8bb1c6e1537a4e6 100644 (file)
@@ -1,7 +1,8 @@
-; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
+; RUN: llvm-as -disable-output <%s 2>&1 | FileCheck %s
 ; CHECK: invalid llvm.dbg.value intrinsic address/value
 ; CHECK-NEXT: call void @llvm.dbg.value({{.*}})
 ; CHECK-NEXT: !""
+; CHECK: warning: ignoring invalid debug info
 
 define void @foo(i32 %a) {
 entry:
index 745f7ada5873891896d4bd0dc7747a489bdc5e82..4415956292c9813834e7bc34084f4787ece9e6dc 100644 (file)
@@ -1,7 +1,8 @@
-; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
+; RUN: llvm-as -disable-output <%s 2>&1 | FileCheck %s
 ; CHECK: invalid llvm.dbg.value intrinsic variable
 ; CHECK-NEXT: call void @llvm.dbg.value({{.*}})
 ; CHECK-NEXT: !""
+; CHECK: warning: ignoring invalid debug info
 
 define void @foo(i32 %a) {
 entry:
index 6db40943ec380fc9b519d33261e91d52ef29d953..efef9a447f4c724e3fd1a0755536aa811456177b 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: not llvm-as %s -disable-output 2>&1 | FileCheck %s
+; RUN: llvm-as %s -disable-output 2>&1 | FileCheck %s
 
 ; CHECK:      function declaration may not have a !dbg attachment
 declare !dbg !4 void @f1()
@@ -26,6 +26,7 @@ define void @bar() !dbg !3 {
   unreachable
 }
 
+; CHECK: warning: ignoring invalid debug info
 !llvm.module.flags = !{!0}
 !0 = !{i32 2, !"Debug Info Version", i32 3}
 
index ae258b7677fa7c52c386e2aeba28624268e9a2a6..fcc1f0b5300f30157625831f8baf6738821e69a5 100644 (file)
@@ -1,6 +1,7 @@
-; RUN: not opt -verify %s 2>&1 | FileCheck %s
+; RUN: llvm-as -disable-output %s 2>&1 | FileCheck %s
 
 ; CHECK: invalid type ref
+; CHECK: warning: ignoring invalid debug info
 
 @bar = global i64 0, align 8, !dbg !0
 
index 4939da92b13e2b028889fc3581e8ef6e614cd546..72404b3088fe6928d6762d04e8e547b061740451 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: not llvm-as < %s 2>&1 | FileCheck %s
-; RUN: llvm-as -disable-verify < %s 2>&1 | opt -verify -S | FileCheck %s  --check-prefix=STRIP
+; RUN: llvm-as -disable-verify < %s | opt -verify -S | FileCheck %s  --check-prefix=STRIP
 
 ; STRIP-NOT: tbaa
 ; STRIP: @f_0
index dffe9e6ace3af1901733908e543f56db27898c2e..9f0f162b74f83db4f80147b795e779d4e60ddd16 100644 (file)
@@ -97,7 +97,8 @@ int main(int argc, char **argv) {
 
   // Parse the file now...
   SMDiagnostic Err;
-  std::unique_ptr<Module> M = parseAssemblyFile(InputFilename, Err, Context);
+  std::unique_ptr<Module> M =
+      parseAssemblyFile(InputFilename, Err, Context, nullptr, !DisableVerify);
   if (!M.get()) {
     Err.print(argv[0], errs());
     return 1;
index fd851f240a4a76f861883b5ad285ed0b5ffc3ca0..73f89c0e155574dd316a156ac834155edfb43bdc 100644 (file)
@@ -444,7 +444,8 @@ int main(int argc, char **argv) {
   }
 
   // Load the input module...
-  std::unique_ptr<Module> M = parseIRFile(InputFilename, Err, Context);
+  std::unique_ptr<Module> M =
+      parseIRFile(InputFilename, Err, Context, !NoVerify);
 
   if (!M) {
     Err.print(argv[0], errs());
index f1f453ed5d106d1005e367accdb635cf23379f52..ac94eb102d6a6fc05424e9340e811070442a8d0c 100644 (file)
@@ -17,7 +17,6 @@
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/LLVMContext.h"
-#include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Module.h"
 #include "gtest/gtest.h"
 
@@ -149,7 +148,7 @@ TEST(VerifierTest, InvalidFunctionLinkage) {
                                           "have external or weak linkage!"));
 }
 
-TEST(VerifierTest, StripInvalidDebugInfo) {
+TEST(VerifierTest, DetectInvalidDebugInfo) {
   {
     LLVMContext C;
     Module M("M", C);
@@ -164,13 +163,6 @@ TEST(VerifierTest, StripInvalidDebugInfo) {
     NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.cu");
     NMD->addOperand(File);
     EXPECT_TRUE(verifyModule(M));
-
-    ModulePassManager MPM(true);
-    MPM.addPass(VerifierPass(false));
-    ModuleAnalysisManager MAM(true);
-    MAM.registerPass([&] { return VerifierAnalysis(); });
-    MPM.run(M, MAM);
-    EXPECT_FALSE(verifyModule(M));
   }
   {
     LLVMContext C;
@@ -195,36 +187,8 @@ TEST(VerifierTest, StripInvalidDebugInfo) {
     // Now break it by not listing the CU at all.
     M.eraseNamedMetadata(M.getOrInsertNamedMetadata("llvm.dbg.cu"));
     EXPECT_TRUE(verifyModule(M));
-
-    ModulePassManager MPM(true);
-    MPM.addPass(VerifierPass(false));
-    ModuleAnalysisManager MAM(true);
-    MAM.registerPass([&] { return VerifierAnalysis(); });
-    MPM.run(M, MAM);
-    EXPECT_FALSE(verifyModule(M));
   }
 }
 
-TEST(VerifierTest, StripInvalidDebugInfoLegacy) {
-  LLVMContext C;
-  Module M("M", C);
-  DIBuilder DIB(M);
-  DIB.createCompileUnit(dwarf::DW_LANG_C89, DIB.createFile("broken.c", "/"),
-                        "unittest", false, "", 0);
-  DIB.finalize();
-  EXPECT_FALSE(verifyModule(M));
-
-  // Now break it.
-  auto *File = DIB.createFile("not-a-CU.f", ".");
-  NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.cu");
-  NMD->addOperand(File);
-  EXPECT_TRUE(verifyModule(M));
-
-  legacy::PassManager Passes;
-  Passes.add(createVerifierPass(false));
-  Passes.run(M);
-  EXPECT_FALSE(verifyModule(M));
-}
-
 } // end anonymous namespace
 } // end namespace llvm