[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Fri May 16 09:49:50 PDT 2025


rnk wrote:

Sorry to hear about the issue. I think the way this is supposed to work is that the clang frontend target ABIInfo is supposed to carefully construct struct types that cause the backend to pass the C struct type correctly in registers and memory. See for example clang/lib/CodeGen/Targets/X86.cpp [classifyReturnType](https://github.com/llvm/llvm-project/blob/7674d6fa9e45c1748d0dd49430aa472028d44a2d/clang/lib/CodeGen/Targets/X86.cpp#L470), which has pretty extensive logic. The AMDGPU one ultimately passes the LLVM struct type directly:
https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/Targets/AMDGPU.cpp#L175

The AArch64.cpp backend insulates itself from the LLVM IR struct types that the frontend generates by creating arrays for HVAs:
https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/Targets/AArch64.cpp#L453

It seems like AMDGPU should be doing something similar.

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


More information about the cfe-commits mailing list