Author: Matthias Springer Date: 2023-11-23T09:22:40+01:00 New Revision: 6367677c9d901f412934b4935c4341dc6d421d36
URL: https://github.com/llvm/llvm-project/commit/6367677c9d901f412934b4935c4341dc6d421d36 DIFF: https://github.com/llvm/llvm-project/commit/6367677c9d901f412934b4935c4341dc6d421d36.diff LOG: [mlir][linalg] `BufferizeToAllocationOp`: fix side effects (#72986) `bufferize_to_allocation` does not bufferize/replace targeted ops if `bufferize_destination_only` is set. Fixes #72931. Added: Modified: mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp Removed: ################################################################################ diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp index de4965f937162ea..ef5d88d46dd28a0 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<MemoryEffects::EffectInstance> &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); _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits