[Mlir-commits] [mlir] [mlir][vector] Fix VectorToSCF in-bounds check for negative indices (PR #224843)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Sep 24 18:50:46 PDT 2026


================
@@ -923,3 +943,24 @@ func.func private @transfer_write_no_alloc_scope()
 %cst = arith.constant dense<0.0> : vector<2x3xf32>
 %m = memref.alloc() : memref<2x3xf32>
 vector.transfer_write %cst, %m[%c0, %c0] : vector<2x3xf32>, memref<2x3xf32>
+
+// -----
+
+// Negative test: dynamic start index. Access is only valid when
+// 0 <= memrefIdx < memrefDim, so the guard must check both bounds
+// explicitly rather than relying on an unsigned reinterpretation trick.
----------------
StarOne01 wrote:

sorry for the confusion, "negative" there meant a negative index value, not a negative test in the MLIR sense. This test actually checks the guard IS generated correctly (scf.if with both bounds checked), so it's a positive test. Fixed the wording, not renaming to @negative_ since nothing here is expected to be absent.

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


More information about the Mlir-commits mailing list