[llvm] CodeGen: Respect function align attribute if less than preferred alignment. (PR #149444)
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 22 18:45:55 PDT 2025
pcc wrote:
> Then getPointerAlignment() would be overly conservative, which would prevent us from removing masking operations. Unless you make getPointerAlignment() also check for the attribute, which... technically works, I guess, but is pretty confusing.
Another consideration is that we may want the object file to have a separate minimum alignment and preferred alignment for a section. This supports the CFI jump table use case that I'm working on, see #149448 and #150151, but I imagine it could also be useful for other section placement techniques. If we did go with the different alignments in the object file I would expect this to be represented using two attributes at the IR level which would be respected with getPointerAlignment().
> Longer-term, I'd prefer to switch Function::getAlign() to return an Align instead of a MaybeAlign.
That seems like a good direction to me.
https://github.com/llvm/llvm-project/pull/149444
More information about the llvm-commits
mailing list