[llvm] [TTI] Keep ParamTys and Arguments matching for variadic intrinsics. (PR #223693)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 08:46:04 PDT 2026


================
@@ -85,6 +85,14 @@ IntrinsicCostAttributes::IntrinsicCostAttributes(
     Arguments.insert(Arguments.begin(), CI.arg_begin(), CI.arg_end());
   FunctionType *FTy = CI.getCalledFunction()->getFunctionType();
   ParamTys.insert(ParamTys.begin(), FTy->param_begin(), FTy->param_end());
+
+  // For variadic intrinsics the declared parameter list can be less than the
+  // actual argument list. Append the types of the variadic arguments, so
+  // ParamTys and Argument sizes match. consumers expect ParamTys and Arguments
+  // to be parallel.
+  if (FTy->isVarArg())
+    for (const Value *Arg : drop_begin(CI.args(), FTy->getNumParams()))
+      ParamTys.push_back(Arg->getType());
----------------
fhahn wrote:

Sounds good to me, much simpler, thanks

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


More information about the llvm-commits mailing list