[PATCH] D77643: Keep output file after successful execution of mlir-opt
Mehdi AMINI via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 7 20:41:39 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd86ece13d938: Keep output file after successful execution of mlir-opt (authored by LukasSommerTu, committed by mehdi_amini).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77643/new/
https://reviews.llvm.org/D77643
Files:
mlir/examples/standalone/standalone-opt/standalone-opt.cpp
mlir/test/mlir-opt/outputfile.mlir
mlir/tools/mlir-opt/mlir-opt.cpp
Index: mlir/tools/mlir-opt/mlir-opt.cpp
===================================================================
--- mlir/tools/mlir-opt/mlir-opt.cpp
+++ mlir/tools/mlir-opt/mlir-opt.cpp
@@ -166,7 +166,12 @@
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;
}
Index: mlir/test/mlir-opt/outputfile.mlir
===================================================================
--- /dev/null
+++ mlir/test/mlir-opt/outputfile.mlir
@@ -0,0 +1,2 @@
+// RUN: mlir-opt %s -o %t
+// RUN: test -f %t
Index: mlir/examples/standalone/standalone-opt/standalone-opt.cpp
===================================================================
--- mlir/examples/standalone/standalone-opt/standalone-opt.cpp
+++ mlir/examples/standalone/standalone-opt/standalone-opt.cpp
@@ -46,6 +46,11 @@
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"),
@@ -91,7 +96,12 @@
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77643.255885.patch
Type: text/x-patch
Size: 2277 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200408/ec710959/attachment.bin>
More information about the llvm-commits
mailing list