diff --git a/llvm/tools/llvm-stress/llvm-stress.cpp b/llvm/tools/llvm-stress/llvm-stress.cpp --- a/llvm/tools/llvm-stress/llvm-stress.cpp +++ b/llvm/tools/llvm-stress/llvm-stress.cpp @@ -29,12 +29,10 @@ #include "llvm/IR/Instruction.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/LLVMContext.h" -#include "llvm/IR/LegacyPassManager.h" #include "llvm/IR/Module.h" #include "llvm/IR/Type.h" #include "llvm/IR/Value.h" #include "llvm/IR/Verifier.h" -#include "llvm/Pass.h" #include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" @@ -761,10 +759,13 @@ return 1; } - legacy::PassManager Passes; - Passes.add(createVerifierPass()); - Passes.add(createPrintModulePass(Out->os())); - Passes.run(*M.get()); + // Check that the generated module is accepted by the verifier. + if (verifyModule(*M.get(), &Out->os())) + report_fatal_error("Broken module found, compilation aborted!"); + + ModuleAnalysisManager MAM; + PrintModulePass(Out->os()).run(*M.get(), MAM); + Out->keep(); return 0;