Index: mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp =================================================================== --- mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp +++ mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp @@ -1089,7 +1089,7 @@ forallOp.getMixedUpperBound(), forallOp.getMixedStep(), /*outputs=*/ValueRange(), forallOp.getMapping()); - newForallOp.getBody()->getTerminator()->erase(); + rewriter.eraseOp(newForallOp.getBody()->getTerminator()); // Move over block contents of the old op. SmallVector replacementBbArgs;