[Mlir-commits] [mlir] [mlir][vector] Don't fold in_bounds for negative constant indices (PR #219681)

Dhairyashil R G llvmlistbot at llvm.org
Sat Sep 5 06:00:08 PDT 2026


================
@@ -1435,6 +1435,53 @@ func.func @no_fold_transfer_write_in_bounds_scalable(%m: memref<4xf32>, %v: vect
 
 // -----
 
+// `in_bounds` promises that the transfer stays within the source *including its
+// starting point*, so a negative index is not in bounds even when the end of
+// the transfer would land inside the source. Here `-1 + 4 <= 8` holds, but
+// element `-1` is still read from outside `%m`.
----------------
dhairyashilRG wrote:

Trimmed rather than dropped. The name covers "negative index", but the reason this test exists is that `-1 + 4 <= 8` holds, the transfer ends inside the source, so the fold looks correct until you account for the starting point. That's the part I don't think a reader recovers from the name, so it's down to two lines now.

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


More information about the Mlir-commits mailing list