[Mlir-commits] [mlir] [mlir][vector] reject negative strides for `vector.load`/`vector.store` (PR #204611)

Andrzej WarzyƄski llvmlistbot at llvm.org
Tue Jun 23 05:51:46 PDT 2026


================
@@ -285,7 +276,7 @@ class VectorLoadStoreConversion : public ConvertOpToLLVMPattern<LoadOrStoreOp> {
         noWrapFlags = noWrapFlags | LLVM::GEPNoWrapFlags::inbounds;
         // `nuw` additionally requires non-negative strides; skip it when the
         // memref has dynamic or negative strides to avoid emitting poison.
-        if (hasNonNegativeStrides(memRefTy))
+        if (memref::hasNonNegativeStaticStrides(memRefTy))
----------------
banach-space wrote:

IIUC, at this point it should be guaranteed that _any_ static strides are non-negative and you only need to check whether there are _any_ dynamic strides, right?

IMO this would convey the constraints more straightforwardly:
```suggestion
        assert((memref::hasNegativeStaticStride(memRefTy) && "Invalid MemRef type - should have been rejected by Op verifier.);
        if (memref::isStaticShape(memRefTy))
```

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


More information about the Mlir-commits mailing list