diff --git a/mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp b/mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/ComprehensiveBufferize.cpp @@ -2190,7 +2190,8 @@ newInputBuffer = createNewAllocDeallocPairForShapedValue( b, loc, writeOp.source(), aliasInfo); Value v = lookup(bvm, writeOp.source()); - b.create(loc, v, newInputBuffer); + if (!isInitTensorOp(writeOp.source())) + b.create(loc, v, newInputBuffer); } else { // InPlace write will result in memref.tensor_load(x) which must // canonicalize away with one of it uses.