[lld] [llvm] [LLVM][LTO] Factor out RTLib calls and allow them to be dropped (PR #98512)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 11 13:13:28 PDT 2024
efriedma-quic wrote:
> So it will always be extracted from a static archive even if it's unused because it thinks the backend needs it.
If the function in the archive is compiled code, this should be cheap, so it doesn't really matter. If it's bitcode, LTO isn't really architected to handle it. I don't think we'd want to modify the way symbol lookup works. Maybe we can pull the bitcode files into the link, but delay actually compiling them until we know whether they're actually necessary. Or we can examine the bitcode inputs in more detail to determine which functions they can actually call.
Some examples of heuristics we could use:
- query target features for whether some specific operation needs to be emulated
- scan the module for declarations of math intrinsics
This patch doesn't address any of that, though; it just ensures that the linker agrees with the LLVM backend about which functions should actually be treated as "runtime functions" for a given triple (i.e. functions which can be called by the LLVM backend even if they aren't referenced in the IR), as opposed to using the same set for every triple.
https://github.com/llvm/llvm-project/pull/98512
More information about the llvm-commits
mailing list