Skip to content

Commit b293c8b

Browse files
[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.)
1 parent 3231cb4 commit b293c8b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ class MaxPool2dConverter : public OpConversionPattern<tosa::MaxPool2dOp> {
807807
ValueRange{paddedInput, fakeWindowDims}, filledEmptyTensor, strideAttr,
808808
dilationAttr);
809809

810+
rewriter.setInsertionPointAfter(op);
810811
rewriter.replaceOp(op, resultOp);
811812

812813
// NaN propagation has no meaning for non floating point types.

0 commit comments

Comments
 (0)