xlauko wrote:

Classic codegen uses `getNaturalPointeeTypeAlignment` (which internally calls 
`getNaturalTypeAlignment(pointeeType, ..., forPointeeType=true)`) in all three 
places:

- Return type — 
[CGCall.cpp:2810-2811](https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGCall.cpp#L2810-L2811):
 getNaturalPointeeTypeAlignment(RetTy)

- this pointer — 
[CGCall.cpp:2871-2874](https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGCall.cpp#L2871-L2874):
 getNaturalTypeAlignment(ThisTy, ..., /*forPointeeType=*/true)

- Reference parameters — 
[CGCall.cpp:3032-3033](https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGCall.cpp#L3032-L3033):
 getNaturalPointeeTypeAlignment(ParamType)

- getNaturalPointeeTypeAlignment definition — 
[CodeGenModule.cpp:8373-8376](https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CodeGenModule.cpp#L8373-L8376):
 calls getNaturalTypeAlignment(T->getPointeeType(), ..., forPointeeType=true)

CIR was calling `getNaturalTypeAlignment` on the reference type itself (getting 
pointer alignment = 8), instead of on the pointee type with 
`forPointeeType=true` (getting the actual type's alignment, e.g. 4 for int, 1 
for incomplete types). You could post these three line references to the 
reviewer to confirm the match.

https://github.com/llvm/llvm-project/pull/186667
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to