[clang] [MS] Follow up fix to pass aligned args to variadic x86_32 functions (PR #65692)

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 13 16:26:39 PDT 2023


================
@@ -812,11 +815,13 @@ ABIArgInfo X86_32ABIInfo::classifyArgumentType(QualType Ty, CCState &State,
     }
     llvm::IntegerType *PaddingType = NeedsPadding ? Int32 : nullptr;
 
-    // Pass over-aligned aggregates on Windows indirectly. This behavior was
-    // added in MSVC 2015. Use the required alignment from the record layout,
-    // since that may be less than the regular type alignment, and types with
-    // required alignment of less than 4 bytes are not passed indirectly.
-    if (IsWin32StructABI) {
+    // Pass over-aligned aggregates to non-variadic functions on Windows
+    // indirectly. This behavior was added in MSVC 2015. Use the required
+    // alignment from the record layout, since that may be less than the
+    // regular type alignment, and types with required alignment of less than 4
+    // bytes are not passed indirectly.
+    if (IsWin32StructABI && (!State.Required.allowsOptionalArgs() ||
+                             ArgIndex < State.Required.getNumRequiredArgs())) {
----------------
rnk wrote:

Sure.

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


More information about the cfe-commits mailing list