[clang] [clang][CodeGen] Omit pre-opt link when post-opt is link requested (PR #85672)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 19 08:59:55 PDT 2024


jhuber6 wrote:

This means that there won't be any optimizations on these definitions, correct? Likely not ideal  to have no inlining even if it saves compilation time.

This "post-op" linking is only required because we emit calls to functions that don't exist in the module. The way we solved this in OpenMP is by always providing the library at the link step and making the optimization passes not emit new calls if we are in "post-link LTO" as determined by module flags.

We could theoretically just force all AMDGPU compilation to go through the LTO pass, something like `ld.lld --start-lib ockl.bc ocml.bc --end-lib`. That would have the effect of fixing-up any missing definitions as it will only extract if needed. Problem is that the device libs have protected visibility until the next release cycle so this won't actually internalize.

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


More information about the cfe-commits mailing list