[llvm] [LLVM][Intrinsics] Add validation for vararg intrinsics (PR #193777)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 23 08:34:36 PDT 2026


================
@@ -707,19 +708,39 @@ class TypeInfoGen<list<LLVMType> RetTypes, list<LLVMType> ParamTypes> {
 
   // Validate that the overload index referenced by dependent types always
   // references an LLVMAnyType type.
-  list<int> InvalidOverload = !foreach(ty, AllTypes,
-    // an entry in the list will be 1 if its a dependent type and it
-    // references another overload type that is not `Any`.
+  list<LLVMType> InvalidOverload = !filter(ty, AllTypes,
+    // A dependent type has an invalid overload index if it references another
+    // overload type that is not `Any`.
     !and(
       !isa<LLVMDependentType>(ty),
-      !if(!ge(!cast<LLVMDependentType>(ty).OverloadIndex, !size(OverloadTypes)),
-        1,
-        !not(!isa<LLVMAnyType>(OverloadTypes[!cast<LLVMDependentType>(ty).OverloadIndex]))
+      !or(
+        !if(!ge(!cast<LLVMDependentType>(ty).OverloadIndex, !size(OverloadTypes)), -1, 0),
----------------
jurahul wrote:

essentially, `!or(1, xxx)` is not short-circuited but `!or(-1, xxx)` is. The `!if()` is mapping the 1/0 to -1, 0. 

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


More information about the llvm-commits mailing list