[Mlir-commits] [mlir] [mlir][memref] Promote buffers accessed via memref.copy (PR #232078)

Jianhui Li llvmlistbot at llvm.org
Sun Oct 18 23:02:29 PDT 2026


================
@@ -162,7 +166,124 @@ Value mlir::memref::buildDynamicSubViewMask(OpBuilder &builder, Location loc,
   return buildSubViewMask(builder, loc, subView);
 }
 
+/// Produces the value that a `memref.copy` stores into a slot: reads `mem` at
+/// the origin into `vecType` with an identity map, marking a dimension
+/// in-bounds only when the memref extent is statically at least the vector
+/// extent.
+///
+/// The padding value does not affect the copy: both operands must have the same
+/// runtime shape. For a whole-buffer slot, the source covers the whole vector.
+/// For a dynamic-subview slot,
+/// `PromotableAliaserInterface::projectAliasValueToSlotValue` discards lanes
+/// outside the subview's extent with a masked select.
+static Value readMemRefAsVector(OpBuilder &builder, Location loc, Value mem,
----------------
Jianhui-Li wrote:

@banach-space  Why createReadOrMaskedRead() generate masked transfer_read, instead of transfer_read with a mask? Which one is the canonical form? Masked transfer_read introducing a region which adds complexity to mem2reg. 

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


More information about the Mlir-commits mailing list