[clang] [llvm] [clang-tools-extra] Dont alter cold function alignment unless using Os (PR #72387)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 15 12:04:01 PST 2023


efriedma-quic wrote:

This patch appears to do two things:

- Add a "default align" attribute, which instructions the backend to use some unspecified "default" alignment for the function in question.
- Tells the frontend to apply this attribute specifically to "cold" functions.

This is basically nonsense.  We already have a way to set alignment: it's the "align" attribute.  And there isn't any obvious reason to special-case "cold" functions.

> This interferes with code replacement features on our targets

Please take a step back and consider what makes sense to express the constraints in general, not what narrowly solves the problem on the current version of your codebase.

If there's an ABI constraint that requires a particular function alignment, clang should be explicitly marking it.  We already do this if you, for example, specify `-falign-functions=16` on the clang command-line.

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


More information about the cfe-commits mailing list