================
@@ -307,7 +307,12 @@ AArch64ABIInfo::classifyArgumentType(QualType Ty, bool 
IsVariadic,
     // 0.
     if (IsEmpty && Size == 0)
       return ABIArgInfo::getIgnore();
-    return ABIArgInfo::getDirect(llvm::Type::getInt8Ty(getVMContext()));
+    // An empty struct can have size greater than one byte if alignment is
+    // involved.
+    // When size <= 64, we still hold it by i8 in IR and lowering to registers.
+    // When Size > 64, just fall through to avoid va_list out of sync.
----------------
rjmccall wrote:

It looks like Tim is just implementing the standard rule from the PCS here and 
just didn't think about the fact that he could let the handling fall through to 
the main path.

`va_arg` would not require empty structs to occupy space for parameter passing; 
at worst, it would require us to recognize empty structs in the `va_arg` logic. 
 Even if it were unimplementable, though, that'd be a psABI problem, not a 
compiler one.

https://github.com/llvm/llvm-project/pull/72197
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to