[Mlir-commits] [mlir] [mlir][vector] Fix vector.gather lowering for strided memrefs. (PR #184706)

Andrzej WarzyƄski llvmlistbot at llvm.org
Fri Mar 13 04:08:41 PDT 2026


================
@@ -200,6 +213,16 @@ struct Gather1DToConditionalLoads : OpRewritePattern<vector::GatherOp> {
     auto baseOffsets = llvm::to_vector(op.getOffsets());
     Value lastBaseOffset = baseOffsets.back();
 
+    // Compute the basis (memref shape) and linearized base offset once,
+    // outside the per-element loop.
+    SmallVector<OpFoldResult> basis;
+    Value linearizedBase;
+    if (useDelinearization) {
+      basis = memref::getMixedSizes(rewriter, loc, base);
+      linearizedBase = affine::AffineLinearizeIndexOp::create(
----------------
banach-space wrote:

```suggestion
      linearizedOffsets = affine::AffineLinearizeIndexOp::create(
```

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


More information about the Mlir-commits mailing list