[Mlir-commits] [mlir] [mlir][vector] reject negative strides for `vector.load`/`vector.store` (PR #204611)
Federico Bruzzone
llvmlistbot at llvm.org
Tue Jun 23 07:37:08 PDT 2026
================
@@ -194,6 +194,25 @@ LogicalResult resolveSourceIndicesRankReducingSubview(
Location loc, OpBuilder &b, memref::SubViewOp subViewOp, ValueRange indices,
SmallVectorImpl<Value> &sourceIndices);
+/// Returns true if all strides of `memRefTy` are static and non-negative.
+///
+/// Dynamic strides cause this to return false because their sign is unknown at
+/// compile time. Use `hasNegativeStaticStride` instead when dynamic strides
+/// should be treated as acceptable.
+///
+/// Typical use: guard `mul nuw` GEP flags during LLVM lowering, where an
+/// unknown-sign stride could make the arithmetic wrap.
+bool hasNonNegativeStaticStrides(MemRefType memRefTy);
+
+/// Returns true if any stride of `memRefTy` is statically known to be
+/// negative.
+///
+/// Dynamic strides are conservatively treated as non-negative (sign unknown),
+/// so only static negative values trigger this predicate. This is the
+/// complement of `hasNonNegativeStaticStrides` for legality checks that must
+/// not reject dynamically-strided memrefs.
----------------
FedericoBruzzone wrote:
Thank you! You're right < 3
https://github.com/llvm/llvm-project/pull/204611
More information about the Mlir-commits
mailing list