================ @@ -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())) { ---------------- rjmccall wrote:
Minor request: please extract this second half into a helper function like `RequiredArgs::isRequiredArg(unsigned)`. https://github.com/llvm/llvm-project/pull/65692 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits