[Mlir-commits] [mlir] [mlir][vector] Remove unit-stride check in Gather1DToConditionalLoads (PR #189178)

Jorn Tuyls llvmlistbot at llvm.org
Sun Mar 29 02:34:37 PDT 2026


================
@@ -195,16 +195,6 @@ struct Gather1DToConditionalLoads : OpRewritePattern<vector::GatherOp> {
     // correct N-D load indices from the 1-D gather index.
     bool useDelinearization = false;
     if (auto memType = dyn_cast<MemRefType>(base.getType())) {
-      // vector.load requires the most minor memref dim to have unit stride
-      // (unless reading exactly 1 element).
-      if (auto stridesAttr =
-              dyn_cast_if_present<StridedLayoutAttr>(memType.getLayout())) {
-        if (stridesAttr.getStrides().back() != 1 &&
-            resultTy.getNumElements() != 1)
----------------
jtuyls wrote:

`resultTy` here is the gather op's result type, so could be something like `vector<3xelemTy>` as in the new test case. Combine that with non-unit stride and the rewrite is rejected and we get a crash at LLVM translation.

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


More information about the Mlir-commits mailing list