[clang] [ARM, AArch64] Fix passing of structures with aligned base classes (PR #135564)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 15 09:57:37 PDT 2025


================
@@ -1302,6 +1302,7 @@ ItaniumRecordLayoutBuilder::LayoutBase(const BaseSubobjectInfo *Base) {
     setSize(std::max(getSize(), Offset + Layout.getSize()));
 
   // Remember max struct/class alignment.
+  UnadjustedAlignment = std::max(UnadjustedAlignment, PreferredBaseAlign);
----------------
efriedma-quic wrote:

If you pass arguments on the stack (use up all the registers), the alignment matters even on Apple... for non-HFA types, at least.  For HFAs, apparently it doesn't matter.  And MSVC has its own funny take on the rules for AArch64: it will pass a misaligned NEON vector on the stack for HVAs containing NEON vectors.

It would be nice to have testcases for all the combinations of Windows/OSX/Linux, register/stack, integer/HFA/HVA, and outer/member alignment... but I guess it doesn't need to be in this patch.  So I'm okay with this going in as-is.

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


More information about the cfe-commits mailing list