[PATCH] D115933: [IR] Change vector.splice intrinsic to reject out-of-bounds indices

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 4 06:40:54 PST 2022


david-arm marked 2 inline comments as done.
david-arm added inline comments.


================
Comment at: llvm/docs/LangRef.rst:17208-17209
 The first two operands are vectors with the same type. The third argument
-``imm`` is the start index, modulo VL, where VL is the runtime vector length of
-the source/result vector. The ``imm`` is a signed integer constant in the range
-``-VL <= imm < VL``. For values outside of this range the result is poison.
+``imm`` is the start index, modulo VL, where VL is the known minimum vector
+length of the source/result vector. The ``imm`` is a signed integer constant
+in the range ``-VL <= imm < VL``. For values outside of this range the
----------------
sdesmalen wrote:
> this isn't strictly correct, for a `<vscale x 4 x i32>` and the IR being compiled with `vscale_range(2, N)` (for N>=2) then `imm = -5` should still be a valid immediate.
> 
> It would be better to phrase this in terms of vscale_range directly.
So I can only really refer to vscale_range for scalable vectors, since this intrinsic also works for fixed length vectors too. I've tried to be more specific for the scalable case.


================
Comment at: llvm/lib/IR/Verifier.cpp:5345-5346
+               (Idx >= 0 && Idx < KnownMinNumElements),
+           "The splice index exceeds the range [-VL, VL-1] where VL is the "
+           "known minimum number of elements in the vector",
+           &Call);
----------------
sdesmalen wrote:
> the number of elements in the vector for the vscale_range being compiled for.
Same problem as above!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115933/new/

https://reviews.llvm.org/D115933



More information about the llvm-commits mailing list