[Mlir-commits] [mlir] 6e5021b - [mlir][NFC] GreedyPatternRewriteDriver: Remove overridden eraseOp
Matthias Springer
llvmlistbot at llvm.org
Mon Jan 16 07:23:22 PST 2023
Author: Matthias Springer
Date: 2023-01-16T16:18:53+01:00
New Revision: 6e5021b8dcce44fad4f1105d0c6841e7ae7c434d
URL: https://github.com/llvm/llvm-project/commit/6e5021b8dcce44fad4f1105d0c6841e7ae7c434d
DIFF: https://github.com/llvm/llvm-project/commit/6e5021b8dcce44fad4f1105d0c6841e7ae7c434d.diff
LOG: [mlir][NFC] GreedyPatternRewriteDriver: Remove overridden eraseOp
It is not necessary to override `eraseOp`, we can use the existing `notifyOperationRemoved`.
Differential Revision: https://reviews.llvm.org/D141844
Added:
Modified:
mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
index 2cf895e271e6..f0794f8dec3f 100644
--- a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
+++ b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
@@ -80,9 +80,6 @@ class GreedyPatternRewriteDriver : public PatternRewriter {
// before the root is changed.
void notifyRootReplaced(Operation *op, ValueRange replacement) override;
- /// PatternRewriter hook for erasing a dead operation.
- void eraseOp(Operation *op) override;
-
/// PatternRewriter hook for notifying match failure reasons.
LogicalResult
notifyMatchFailure(Location loc,
@@ -394,6 +391,11 @@ void GreedyPatternRewriteDriver::addOperandsToWorklist(ValueRange operands) {
}
void GreedyPatternRewriteDriver::notifyOperationRemoved(Operation *op) {
+ LLVM_DEBUG({
+ logger.startLine() << "** Erase : '" << op->getName() << "'(" << op
+ << ")\n";
+ });
+
addOperandsToWorklist(op->getOperands());
op->walk([this](Operation *operation) {
removeFromWorklist(operation);
@@ -412,14 +414,6 @@ void GreedyPatternRewriteDriver::notifyRootReplaced(Operation *op,
addToWorklist(user);
}
-void GreedyPatternRewriteDriver::eraseOp(Operation *op) {
- LLVM_DEBUG({
- logger.startLine() << "** Erase : '" << op->getName() << "'(" << op
- << ")\n";
- });
- PatternRewriter::eraseOp(op);
-}
-
LogicalResult GreedyPatternRewriteDriver::notifyMatchFailure(
Location loc, function_ref<void(Diagnostic &)> reasonCallback) {
LLVM_DEBUG({
More information about the Mlir-commits
mailing list