[llvm] [IR] Add support for runtime mask within `llvm.shufflevector` intrinsic (PR #208872)

Oscar Smith via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 10 20:56:07 PDT 2026


================
@@ -11514,9 +11527,11 @@ mask elements, also producing a `poison` element in the result.
 If the shuffle mask selects an `undef` element from one of the input
 vectors, the resulting element is `undef`.
 
-For scalable vectors, the only valid mask values at present are
+For scalable vectors, the only valid *constant* mask values at present are
 `zeroinitializer`, `undef` and `poison`, since we cannot write all indices as
-literals for a vector with a length unknown at compile time.
+literals for a vector with a length unknown at compile time; run-time masks
+carry no such restriction. For scalable vectors, a run-time mask must have
+the same element count as the input vectors.
----------------
oscardssmith wrote:

The alternate option here would be to use the generalization of allowing OOB=poision rather than invalid to make supporting literal bounds support scalable vectors (where if you have an index higher than the runtime vector length you get poisons), but I'm not sure if that's useful and it would have been more complex.

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


More information about the llvm-commits mailing list