[clang] [Clang] Make the GPU toolchains implicitly link `-lm` and `-lc` (PR #98170)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 9 08:31:00 PDT 2024


jhuber6 wrote:

So, one thing I've noticed is that passing `-lc` and `-lm` to the `ld.lld` invocation greatly increases link times for trivial applications. This is because the handling in `ld.lld` will intentionally extract known `libcall` functions from LTO static libraries. We then have handling in the LTO internalization pass  that prevents these calls from being internalized so that the backend may emit calls to them. This has the result of increasing the compile time as it extracts about fifty math functions, as well as bloating the resulting binary because they do not get optimized out. The AMDGPU backend doesn't emit any of these as far as I'm aware. Right now this simply goes off of a list of all libcalls. I wonder if I can make a separate list that's per-target, just to show that the AMDGPU target doesn't emit any of these for now and should be internalized / not extracted. WDYT @yxsamliu and @arsenm ?

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


More information about the cfe-commits mailing list