[Mlir-commits] [mlir] b293c8b - [mlir][TosaToLinalg] Ensure valid insertion pointer after op erasure (#146908)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Jul 11 04:46:28 PDT 2025


Author: Matthias Springer
Date: 2025-07-11T13:46:25+02:00
New Revision: b293c8bfb6dd658c7e0197b93617b9083f2bb9cc

URL: https://github.com/llvm/llvm-project/commit/b293c8bfb6dd658c7e0197b93617b9083f2bb9cc
DIFF: https://github.com/llvm/llvm-project/commit/b293c8bfb6dd658c7e0197b93617b9083f2bb9cc.diff

LOG: [mlir][TosaToLinalg] Ensure valid insertion pointer after op erasure (#146908)

Erasing/replacing an op, which is also the current insertion point,
invalidates the insertion point. Explicitly set the insertion point, so
that subsequent op insertions do not crash after the One-Shot Dialect
Conversion refactoring. (`ConversionPatternRewriter` will start behaving
more like a "normal" rewriter.)

Added: 
    

Modified: 
    mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp
index b89fde4fbc17e..c1f40dcbd5ca0 100644
--- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp
+++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp
@@ -807,6 +807,7 @@ class MaxPool2dConverter : public OpConversionPattern<tosa::MaxPool2dOp> {
         ValueRange{paddedInput, fakeWindowDims}, filledEmptyTensor, strideAttr,
         dilationAttr);
 
+    rewriter.setInsertionPointAfter(op);
     rewriter.replaceOp(op, resultOp);
 
     // NaN propagation has no meaning for non floating point types.


        


More information about the Mlir-commits mailing list