[PATCH] D146242: [ARM] Fixing ABI mismatch for packed structs passed as function arguments

Jirui Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 30 03:06:17 PDT 2023


JiruiWu marked an inline comment as done.
JiruiWu added inline comments.


================
Comment at: clang/lib/CodeGen/TargetInfo.cpp:5813
         getContext().getTypeUnadjustedAlignInChars(Ty).getQuantity();
-    unsigned BaseAlign = getContext().getTypeAlignInChars(Base).getQuantity();
-    Align = (Align > BaseAlign && Align >= 16) ? 16 : 0;
+    Align = (Align >= 16) ? 16 : 8;
     return ABIArgInfo::getDirect(
----------------
chill wrote:
> The backend ought to set the minimum alignment of a stack slot to 8 anyway (for AAPCS), hence setting the minimum here to 8 is redundant.
> 
This 8 is necessary. I tried to use 0 instead of 8 but clang set the alignment to 16 by default, which is wrong. Specifying the alignment to 8 here fixes the problem.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146242/new/

https://reviews.llvm.org/D146242



More information about the cfe-commits mailing list