Use LLVM's externally_available linkage for inline functions #89154
Labels
A-codegen
Area: Code generation
A-linkage
Area: linking into static, shared libraries and binaries
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
WG-llvm
Working group: LLVM backend code generation
This tells LLVM that the function has a given definition to allow for inlining, but that the function is already externally defined, so locally emitting object code for it is not necessary. It is necessary to provide an export elsewhere though. This can be done by making the monomorphization collector handle them like normal functions when it isn't being inlined from another crate or cgu.
On one hand this will likely save executable size and for debug mode compilation time as codegen of inline functions can be skipped. On the other hand it will likely result in bigger libraries due to the extra inlined functions. It will also break the (incorrect) assumption that some crates have that
#[inline]
functions are never codegened if not used.Codegen backends that don't support externally_available can treat it as local or if they don't support inlining at all don't codegen them at all.
The text was updated successfully, but these errors were encountered: