[llvm] [IR] Change getParamIndexForOptionalMask to assume masked parameter is last (PR #180558)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 10 01:22:23 PST 2026


================
@@ -132,11 +132,10 @@ struct VFInfo {
   /// if any exist.
   std::optional<unsigned> getParamIndexForOptionalMask() const {
     unsigned ParamCount = Shape.Parameters.size();
-    for (unsigned i = 0; i < ParamCount; ++i)
-      if (Shape.Parameters[i].ParamKind == VFParamKind::GlobalPredicate)
-        return i;
-
-    return std::nullopt;
+    if (!ParamCount || Shape.Parameters[ParamCount - 1].ParamKind !=
+                           VFParamKind::GlobalPredicate)
+      return std::nullopt;
----------------
fhahn wrote:

do we already check/assert that if there is a `VFParamKind::GlobalPredicate`, there is exactly one and it is at the end? Would probably be good to do and/or also assert here

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


More information about the llvm-commits mailing list