[Mlir-commits] [mlir] [MLIR] Fix ErasedOpsListener false positives for newly created ops/blocks (PR #192291)
Jakub Kuderski
llvmlistbot at llvm.org
Thu Apr 16 06:52:08 PDT 2026
================
@@ -578,8 +578,10 @@ linalg::dropUnitDims(RewriterBase &rewriter, GenericOp genericOp,
b.cloneRegionBefore(genericOp.getRegion(), replacementOp.getRegion(),
replacementOp.getRegion().begin());
// 5a. Replace `linalg.index` operations that refer to the dropped unit
- // dimensions.
- IRRewriter rewriter(b);
+ // dimensions. Use a fresh IRRewriter to avoid inheriting any listener
+ // from the builder (e.g., WalkPatternRewriter's erasure listener),
+ // since the ops being erased here are newly cloned, not the matched op.
+ IRRewriter rewriter(b.getContext());
----------------
kuhar wrote:
I'm confused why he have to do this given that we are relaxing the checks in the walk driver? The listener we are forwarding to might be interested in these updates, no?
https://github.com/llvm/llvm-project/pull/192291
More information about the Mlir-commits
mailing list