[clang] [X86_32] Teach X86_32 va_arg to ignore empty structs. (PR #86075)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 22 12:11:44 PDT 2024


================
@@ -1069,6 +1069,10 @@ Address X86_32ABIInfo::EmitVAArg(CodeGenFunction &CGF,
 
   auto TypeInfo = getContext().getTypeInfoInChars(Ty);
 
+  // Empty records are ignored for parameter passing purposes on non-Windows.
+  if (!IsWin32StructABI && isEmptyRecord(getContext(), Ty, true))
+    return CGF.CreateMemTemp(Ty);
----------------
efriedma-quic wrote:

If it doesn't work with the code as-is, please refactor to the code to make it work.  Scattered checks like this are hard to maintain.

The simplest thing here would be to just construct a CCState here, I think?  Or if that doesn't work for some reason, make the CCState parameter to classifyArgumentType optional.

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


More information about the cfe-commits mailing list