efriedma-quic wrote:

> Is clang aware of the target's default function alignment?

No?  On x86, the "default" is set by the line 
`setPrefFunctionAlignment(Align(16));`.  Which, as the name suggests, is 
supposed to be a preference, not a mandatory minimum.  And it's subject to 
change in the future if we find that a different number is better on some 
targets, or for certain functions.

> > there isn't any obvious reason to special-case "cold" functions.
> 
> I'd thought that was clear. Cold implies opt-for-size, which implies align(1)

If there's a relevant ABI rule here, we want to mark it on all functions.  So 
if, for example, some optimization decides a function is cold, we get the same 
result.

> If the tweak to the definition of "cold" should be specific to our targets, 
> we can certainly do that.

If there's some relevant ABI rule, clang should compute the required alignment 
explicitly, and explicitly mark functions with the required alignment.  If 
that's target-specific, that's fine.  Ideally, it should be controllable by a 
flag separate from the optimization level.

https://github.com/llvm/llvm-project/pull/72387
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to