[clang] [clang][AArch64] Don't round parameters to multiples of 8-byte (PR #215264)

via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 16 04:54:04 PDT 2026


eleviant wrote:


> As I understand it, the reason to extend the size of the argument is to maintain the 8-byte alignment of the stack, and when passing in registers, there's no register that contains more than one composite type.

This condition seems to be enforced by backend allocating slot of minimum 8 bytes in size, no matter what size does integer argument have in IR. BTW, this patch https://reviews.llvm.org/D100591 already does the same for return values
 
> If the code here maintains the AAPCS rules then no objections from me. I'm not sufficiently familiar with code to check that, will need someone more familiar with clang to approve.

As per rule C.16 in https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#682parameter-passing-rules

```
If the size of the argument is less than 8 bytes then the size of the argument is set to 8 bytes. The effect is as if the argument was copied to the least significant bits of a 64-bit register and the remaining bits filled with unspecified values.
```
So I think we still follow the rules for small composites, even if we narrow down arguments in IR.


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


More information about the cfe-commits mailing list