[Mlir-commits] [mlir] [MLIR][Affine] Fix dead store elimination for vector stores with different types (PR #189248)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Wed Apr 1 01:51:27 PDT 2026


================
@@ -936,6 +937,13 @@ static void findUnusedStore(AffineWriteOpInterface writeA,
     if (srcAccess != destAccess)
       continue;
 
+    // Check that the store types match. If types differ, writeB may not cover
+    // all bytes written by writeA (e.g. a narrower vector type), so
+    // conservatively assume writeA is not dead.
+    if (writeA.getValueToStore().getType() !=
----------------
ftynse wrote:

There are surprising cases with things like `vector<4xi6>` vs `vector<3xi8>` depending on how bitpacking is interpreted, which in turn may be data layout-specific. So I'd rather have exact type match until there's a need to relax.

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


More information about the Mlir-commits mailing list