[Mlir-commits] [mlir] [mlir][linalg] Add PackOp canonicalization pattern (PR #215785)

Renato Golin llvmlistbot at llvm.org
Wed Aug 12 06:25:00 PDT 2026


================
@@ -6008,6 +6008,13 @@ LogicalResult PackOp::canonicalize(PackOp packOp, PatternRewriter &rewriter) {
     }
   }
 
+  // Fold pack(empty) to the destination tensor if no padding value is provided.
+  if (packOp.getSource().getDefiningOp<tensor::EmptyOp>() &&
----------------
rengolin wrote:

Does `pack` guarantee `dest` is also `empty`?

If the dest buffer already contain information (DPS buffer reuse), then bufferization may get wrong and propagate the previous data instead of moving from the `src` buffer.

https://github.com/llvm/llvm-project/pull/215785


More information about the Mlir-commits mailing list