diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp index de4965f937162..ef5d88d46dd28 100644 --- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp +++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp @@ -289,7 +289,13 @@ DiagnosedSilenceableFailure transform::BufferizeToAllocationOp::apply( void transform::BufferizeToAllocationOp::getEffects( SmallVectorImpl &effects) { - consumesHandle(getTarget(), effects); + if (getBufferizeDestinationOnly()) { + // The destination is replaced with a newly allocated buffer, but the op + // itself remains in place. + onlyReadsHandle(getTarget(), effects); + } else { + consumesHandle(getTarget(), effects); + } producesHandle(getAllocatedBuffer(), effects); producesHandle(getNewOps(), effects); modifiesPayload(effects);