[Mlir-commits] [mlir] [mlir][linalg] Hoist masked vector transfer pairs (PR #221481)

Hugo Pompougnac llvmlistbot at llvm.org
Thu Sep 17 05:31:28 PDT 2026


================
@@ -233,13 +238,25 @@ void mlir::linalg::hoistRedundantVectorTransfers(Operation *root,
                         << "\n");
 
       SetVector<Operation *> forwardSlice;
-      getForwardSlice(transferRead.getOperation(), &forwardSlice);
+      getForwardSlice(readUnit, &forwardSlice);
+      // A forward slice does not follow a value out of a `vector.mask` region,
+      // so re-slice from each enclosing mask op to reach the write.
+      for (unsigned i = 0; i < forwardSlice.size(); ++i) {
+        auto mask = forwardSlice[i]->getParentOfType<vector::MaskOp>();
+        if (mask && forwardSlice.insert(mask.getOperation()))
+          getForwardSlice(mask.getOperation(), &forwardSlice);
+      }
----------------
qaco wrote:

You are right, the re-slice loop was a leftover workaround from when the slice started at the inner `transfer_read`; once the slice root was changed to the enclosing `vector.mask` op, it became redundant. I remove it.

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


More information about the Mlir-commits mailing list