[llvm] [CodeGen] Don't allow function alignment less than the target's minimum (PR #90415)

Doug Wyatt via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 10:22:34 PDT 2024


dougsonos wrote:

> On 32-bit Arm, function pointer alignment is only 1 byte (8 bits as spelled in the datalayout) because of the way Thumb works. On 64-bit, 4 bytes should be right. (And on PPC, it depends on the ABI.) I've been meaning to extend the function pointer alignment specification to other targets, but didn't get around to it. Didn't realize it affected this code.
> 
> getPointerAlignment queries the datalayout already, so if the datalayout specifies the alignment, the existing code should just work.
> 
> The alternative here is to add some code to clang/lib/Basic/Targets to specify function pointer alignment... (You can't call TargetLowering from clang; clang IR generation is intentionally separated from the backend.)

My mistake, I read the "Fi8" in the ARM/PPC data layouts as 8 bytes, but of course it's 8 bits.

I could add "Fi32" to the AArch64 data layouts. (Any pointers to how to do this most cleanly?)

(newbie Q: Should I open a different PR or repurpose this one?)

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


More information about the llvm-commits mailing list