diff --git a/mlir/lib/IR/PatternMatch.cpp b/mlir/lib/IR/PatternMatch.cpp --- a/mlir/lib/IR/PatternMatch.cpp +++ b/mlir/lib/IR/PatternMatch.cpp @@ -266,7 +266,8 @@ "incorrect # of replacement values"); op->replaceAllUsesWith(newValues); - notifyOperationRemoved(op); + op->walk( + [&](Operation *op) { notifyOperationRemoved(op); }); op->erase(); } @@ -274,7 +275,8 @@ /// the given operation *must* be known to be dead. void RewriterBase::eraseOp(Operation *op) { assert(op->use_empty() && "expected 'op' to have no uses"); - notifyOperationRemoved(op); + op->walk( + [&](Operation *op) { notifyOperationRemoved(op); }); op->erase(); }