diff --git a/mlir/lib/Transforms/Utils/OneToNTypeConversion.cpp b/mlir/lib/Transforms/Utils/OneToNTypeConversion.cpp --- a/mlir/lib/Transforms/Utils/OneToNTypeConversion.cpp +++ b/mlir/lib/Transforms/Utils/OneToNTypeConversion.cpp @@ -211,6 +211,8 @@ // original op with those. assert(newValues.size() == resultMapping.getConvertedTypes().size()); assert(op->getResultTypes() == resultMapping.getOriginalTypes()); + PatternRewriter::InsertionGuard g(*this); + setInsertionPointAfter(op); SmallVector castResults = buildUnrealizedBackwardsCasts(newValues, resultMapping, *this); replaceOp(op, castResults); @@ -218,6 +220,8 @@ Block *OneToNPatternRewriter::applySignatureConversion( Block *block, OneToNTypeMapping &argumentConversion) { + PatternRewriter::InsertionGuard g(*this); + // Split the block at the beginning to get a new block to use for the // updated signature. SmallVector locs;