diff --git a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp --- a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp +++ b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp @@ -80,9 +80,6 @@ // 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::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 @@ 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 reasonCallback) { LLVM_DEBUG({