[clang] [libc] [llvm] [NVPTX] Implement variadic functions using IR lowering (PR #96015)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 18 20:19:11 PDT 2024


================
@@ -203,8 +203,15 @@ ABIArgInfo NVPTXABIInfo::classifyArgumentType(QualType Ty) const {
 void NVPTXABIInfo::computeInfo(CGFunctionInfo &FI) const {
   if (!getCXXABI().classifyReturnType(FI))
     FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
-  for (auto &I : FI.arguments())
-    I.info = classifyArgumentType(I.type);
+
+  unsigned ArgumentsCount = 0;
+  for (auto &I : FI.arguments()) {
+    if (FI.isVariadic() && ArgumentsCount > 0)
----------------
efriedma-quic wrote:

Special-casing argument 0 is sort of unusual; are you sure this is what you want?  Normally, I'd expect the distinguishing factor to be fixed vs. variadic: so all explicitly specified parameters are treated the same, then all arguments in the variadic list are passed the same.

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


More information about the cfe-commits mailing list