[Mlir-commits] [mlir] [mlir][vector] reject negative strides for `vector.load`/`vector.store` (PR #204611)
Federico Bruzzone
llvmlistbot at llvm.org
Mon Jun 22 04:29:50 PDT 2026
================
@@ -6194,6 +6194,13 @@ LogicalResult vector::LoadOp::verify() {
if (failed(verifyLoadStoreMemRefLayout(*this, resVecTy, memRefTy)))
return failure();
+ // Negative strides are not supported on vector.load.
+ auto [strides, offset] = memRefTy.getStridesAndOffset();
+ for (int64_t stride : strides) {
+ if (ShapedType::isStatic(stride) && stride < 0)
+ return emitOpError("memref strides must be non-negative");
+ }
----------------
FedericoBruzzone wrote:
I just tried and found that this wasn't possible.
The semantics were simply subtly different.
I still made a substantial improvement and unified everything in the same spot.
Overall:
1. hasNonNegativeStrides returns true only if all strides are **static AND non-negative** (It doesn't allow dynamic)
2. (I introduced) hasNegativeStaticStride returns true if there is a **static stride < 0** (It allows dynamic stride)
https://github.com/llvm/llvm-project/pull/204611
More information about the Mlir-commits
mailing list