[clang] [Clang] Support `-falign-loops=N` for LTO (PR #181702)

Anton Sidorenko via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 19 04:50:46 PST 2026


asi-sc wrote:

> Thoughts on making this a function attribute, instead of trying to directly pass it to the linker?

I'd say this PR is a quick fix for a common issue users face when trying to use `falign-loops` option -- it should not introduce (I hope) any additional issues. It doesn't fix all the problems though: for example, in two-step compilation with LTO enabled, users must not forget to pass this option at the linking step; the option passed to the first step (.c -> .o) is silently ignored.

I agree that the proper solution would likely require the use of a function attribute or some metadata (I think `[[clang::code_align(N)]]` use it). That would allow us to provide diagnostics if users tried to apply different alignments accross compilation steps, handle alignments merging, or something else. Unfortunately, I don’t have the bandwidth to take on that larger redesign right now.

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


More information about the cfe-commits mailing list