summaryrefslogtreecommitdiff
path: root/tools/opt/NewPMDriver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/opt/NewPMDriver.cpp')
-rw-r--r--tools/opt/NewPMDriver.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/opt/NewPMDriver.cpp b/tools/opt/NewPMDriver.cpp
index 2d210387f8..f21a68fc8a 100644
--- a/tools/opt/NewPMDriver.cpp
+++ b/tools/opt/NewPMDriver.cpp
@@ -21,6 +21,7 @@
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/IR/Verifier.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ToolOutputFile.h"
@@ -30,13 +31,20 @@ using namespace opt_tool;
bool llvm::runPassPipeline(StringRef Arg0, LLVMContext &Context, Module &M,
tool_output_file *Out, StringRef PassPipeline,
- OutputKind OK) {
+ OutputKind OK, VerifierKind VK) {
ModulePassManager MPM;
- if (!parsePassPipeline(MPM, PassPipeline)) {
+
+ if (VK > VK_NoVerifier)
+ MPM.addPass(VerifierPass());
+
+ if (!parsePassPipeline(MPM, PassPipeline, VK == VK_VerifyEachPass)) {
errs() << Arg0 << ": unable to parse pass pipeline description.\n";
return false;
}
+ if (VK > VK_NoVerifier)
+ MPM.addPass(VerifierPass());
+
// Add any relevant output pass at the end of the pipeline.
switch (OK) {
case OK_NoOutput: