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

Andrzej WarzyƄski llvmlistbot at llvm.org
Fri Jun 19 01:14:09 PDT 2026


================
@@ -0,0 +1,25 @@
+// RUN: mlir-opt %s -split-input-file -verify-diagnostics
+
+// -----
+
+func.func @load_negative_stride(%base: memref<100x100xf32>) -> vector<8xf32> {
+  // expected-error @+5 {{'vector.load' op memref strides must be non-negative}}
+  %flip = memref.reinterpret_cast %base to
+      offset: [0], sizes: [100, 100], strides: [-100, 1]
+      : memref<100x100xf32> to memref<100x100xf32, strided<[-100, 1]>>
----------------
banach-space wrote:

Instead of using `memref.reinterpret_cast`, could you just pass `memref<100x100xf32, strided<[-100, 1]>>, vector<8xf32>` as an argument? There's no need for an extra Op to test `vector.load` verifier.

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


More information about the Mlir-commits mailing list