[Mlir-commits] [mlir] 18465bc - [mlir][NFC] Cleanup the MLIRTestReducer pass
River Riddle
llvmlistbot at llvm.org
Tue Jun 22 18:33:02 PDT 2021
Author: River Riddle
Date: 2021-06-23T01:29:24Z
New Revision: 18465bcf4dbad4a4035f1f306b1a787e0bf92828
URL: https://github.com/llvm/llvm-project/commit/18465bcf4dbad4a4035f1f306b1a787e0bf92828
DIFF: https://github.com/llvm/llvm-project/commit/18465bcf4dbad4a4035f1f306b1a787e0bf92828.diff
LOG: [mlir][NFC] Cleanup the MLIRTestReducer pass
Added:
Modified:
mlir/test/lib/Reducer/MLIRTestReducer.cpp
Removed:
################################################################################
diff --git a/mlir/test/lib/Reducer/MLIRTestReducer.cpp b/mlir/test/lib/Reducer/MLIRTestReducer.cpp
index d46fe7baa3ccf..5893020f88e08 100644
--- a/mlir/test/lib/Reducer/MLIRTestReducer.cpp
+++ b/mlir/test/lib/Reducer/MLIRTestReducer.cpp
@@ -14,40 +14,33 @@
#include "mlir/Pass/Pass.h"
-#define PASS_NAME "test-mlir-reducer"
-
using namespace mlir;
-static llvm::cl::OptionCategory clOptionsCategory(PASS_NAME " options");
-
namespace {
/// This pass looks for for the presence of an operation with the name
/// "crashOp" in the input MLIR file and crashes the mlir-opt tool if the
/// operation is found.
-struct TestReducer : public PassWrapper<TestReducer, FunctionPass> {
- StringRef getArgument() const final { return PASS_NAME; }
+struct TestReducer : public PassWrapper<TestReducer, OperationPass<>> {
+ StringRef getArgument() const final { return "test-mlir-reducer"; }
StringRef getDescription() const final {
return "Tests MLIR Reduce tool by generating failures";
}
- TestReducer() = default;
- TestReducer(const TestReducer &pass){};
- void runOnFunction() override;
+ void runOnOperation() override;
};
} // end anonymous namespace
-void TestReducer::runOnFunction() {
- for (auto &op : getOperation())
- op.walk([&](Operation *op) {
- StringRef opName = op->getName().getStringRef();
-
- if (opName.contains("op_crash")) {
- llvm::errs() << "MLIR Reducer Test generated failure: Found "
- "\"crashOp\" operation\n";
- exit(1);
- }
- });
+void TestReducer::runOnOperation() {
+ getOperation()->walk([&](Operation *op) {
+ StringRef opName = op->getName().getStringRef();
+
+ if (opName.contains("op_crash")) {
+ llvm::errs() << "MLIR Reducer Test generated failure: Found "
+ "\"crashOp\" operation\n";
+ exit(1);
+ }
+ });
}
namespace mlir {
More information about the Mlir-commits
mailing list