[clang] [AArch64][Clang] Limit variadic onstack args to 8 bytes on Arm64EC. (PR #154578)

via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 20 10:28:30 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,c -- clang/lib/CodeGen/Targets/AArch64.cpp clang/test/CodeGen/AArch64/varargs-ms.c
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/CodeGen/Targets/AArch64.cpp b/clang/lib/CodeGen/Targets/AArch64.cpp
index 1e00bd76f..6b26c67bb 100644
--- a/clang/lib/CodeGen/Targets/AArch64.cpp
+++ b/clang/lib/CodeGen/Targets/AArch64.cpp
@@ -474,8 +474,10 @@ ABIArgInfo AArch64ABIInfo::classifyArgumentType(QualType Ty, bool IsVariadicFn,
           Ty, IsNamedArg, NVec, NPred, UnpaddedCoerceToSeq, NSRN, NPRN);
   }
 
-  // Aggregates <= 16 bytes (8 bytes for variadic Arm64EC) are passed directly in registers or on the stack.
-  uint64_t MaxDirectSize = (IsVariadicFn && getTarget().getTriple().isWindowsArm64EC()) ? 64 : 128;
+  // Aggregates <= 16 bytes (8 bytes for variadic Arm64EC) are passed directly
+  // in registers or on the stack.
+  uint64_t MaxDirectSize =
+      (IsVariadicFn && getTarget().getTriple().isWindowsArm64EC()) ? 64 : 128;
   if (Size <= MaxDirectSize) {
     unsigned Alignment;
     if (Kind == AArch64ABIKind::AAPCS) {
@@ -1153,8 +1155,10 @@ RValue AArch64ABIInfo::EmitMSVAArg(CodeGenFunction &CGF, Address VAListAddr,
                                    QualType Ty, AggValueSlot Slot) const {
   bool IsIndirect = false;
 
-  // Composites larger than 16 bytes (8 bytes on Arm64EC) are passed by reference.
-  uint64_t MaxDirectSize = getTarget().getTriple().isWindowsArm64EC() ? 64 : 128;
+  // Composites larger than 16 bytes (8 bytes on Arm64EC) are passed by
+  // reference.
+  uint64_t MaxDirectSize =
+      getTarget().getTriple().isWindowsArm64EC() ? 64 : 128;
   if (isAggregateTypeForABI(Ty) && getContext().getTypeSize(Ty) > MaxDirectSize)
     IsIndirect = true;
 

``````````

</details>


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


More information about the cfe-commits mailing list