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 @@ -51,6 +51,10 @@ /// If the specified operation is in the worklist, remove it. void removeFromWorklist(Operation *op); + /// Notifies the driver that the specified operation may have been modified + /// in-place. + void finalizeRootUpdate(Operation *op) override; + protected: // Implement the hook for inserting operations, and make sure that newly // inserted ops are added to the worklist for processing. @@ -326,6 +330,14 @@ addToWorklist(op); } +void GreedyPatternRewriteDriver::finalizeRootUpdate(Operation *op) { + LLVM_DEBUG({ + logger.startLine() << "** Modified: '" << op->getName() << "'(" << op + << ")\n"; + }); + addToWorklist(op); +} + void GreedyPatternRewriteDriver::addOperandsToWorklist(ValueRange operands) { for (Value operand : operands) { // If the use count of this operand is now < 2, we re-add the defining