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

Andrzej WarzyƄski llvmlistbot at llvm.org
Tue Oct 20 11:58:56 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,
----------------
banach-space wrote:

Thanks! I like that lot - it composes very nicely with `Vector` masking.

> Does it looks reasonable to you? If it does, I can split it to two PRs (one to enhance the mem2reg interface, the other is to add masked transfer op support for PromotableMemOpInterface).

+1

Are you suggesting to re-base this PR on top of https://github.com/llvm/llvm-project/pull/233705?

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


More information about the Mlir-commits mailing list