llvm::cl::desc("Run the verifier after each transformation pass"),
llvm::cl::init(true));
+static llvm::cl::opt<bool> allowUnregisteredDialects(
+ "allow-unregistered-dialect",
+ llvm::cl::desc("Allow operation with no registered dialects"),
+ llvm::cl::init(false));
+
static llvm::cl::opt<bool>
showDialects("show-dialects",
llvm::cl::desc("Print the list of registered dialects"),
exit(1);
}
- return failed(mlir::MlirOptMain(output->os(), std::move(file), passPipeline,
- splitInputFile, verifyDiagnostics,
- verifyPasses));
+ if (failed(MlirOptMain(output->os(), std::move(file), passPipeline,
+ splitInputFile, verifyDiagnostics, verifyPasses,
+ allowUnregisteredDialects))) {
+ return 1;
+ }
+ // Keep the output file if the invocation of MlirOptMain was successful.
+ output->keep();
+ return 0;
}
exit(1);
}
- return failed(MlirOptMain(output->os(), std::move(file), passPipeline,
- splitInputFile, verifyDiagnostics, verifyPasses,
- allowUnregisteredDialects));
+ if (failed(MlirOptMain(output->os(), std::move(file), passPipeline,
+ splitInputFile, verifyDiagnostics, verifyPasses,
+ allowUnregisteredDialects))) {
+ return 1;
+ }
+ // Keep the output file if the invocation of MlirOptMain was successful.
+ output->keep();
+ return 0;
}