[Mlir-commits] [mlir] [mlir][affine] Fix replaceAllMemRefUsesWith failing on memref.load/store (PR #217833)

Longsheng Mou llvmlistbot at llvm.org
Sun Sep 6 06:48:37 PDT 2026


================
@@ -495,3 +495,32 @@ func.func @multiple_blocks(%arg0: index) -> memref<1x2x1xi32> {
 ^bb3:  // pred: ^bb1
   return %1 : memref<1x2x1xi32>
 }
+
+// -----
+
+// Test that memref.store on the same memref as affine.load/store doesn't
+// cause replaceAllMemRefUsesWith to fail. Before the fix, memref.store
+// (which doesn't implement AffineMapAccessInterface) caused the entire
+// memref replacement to fail silently, leaving the fast buffer uninitialized.
+
+memref.global "private" @__constant_4xi32 : memref<4xi32> = dense<[3, -7, 11, -13]>
+
+// CHECK-LABEL:   func.func @memref_store_with_affine_access() -> i32 {
----------------
CoTinker wrote:

I think we don't need to address the orphan `memref.store` op.

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


More information about the Mlir-commits mailing list