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

Harald van Dijk via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 15 10:37:24 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);
----------------
hvdijk 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.

Ah, of course, thanks for pointing that out.

> I think it would be better to get that testing in this patch; it really should've been part of the original composite alignment patch, because the fact that some targets explicitly don't use it is a major aspect of the work.

I get where you're coming from but `aapcs64-align.cpp` is specifically for testing AAPCS64 alignment, I don't think it would be right to extend that to checking that non-AAPCS64 targets *don't* use the AAPCS64 ABI. We could possibly add this to the `clang/test/CodeGen/AArch64/args*` tests, I'll have a look.

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


More information about the cfe-commits mailing list