Skip to content

Use LLVM's externally_available linkage for inline functions #89154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bjorn3 opened this issue Sep 21, 2021 · 1 comment
Open

Use LLVM's externally_available linkage for inline functions #89154

bjorn3 opened this issue Sep 21, 2021 · 1 comment
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

Comments

@bjorn3
Copy link
Member

bjorn3 commented Sep 21, 2021

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.

@bjorn3 bjorn3 added A-linkage Area: linking into static, shared libraries and binaries C-enhancement Category: An issue proposing an enhancement or a PR with one. A-codegen Area: Code generation WG-llvm Working group: LLVM backend code generation labels Sep 21, 2021
@bjorn3
Copy link
Member Author

bjorn3 commented Jun 4, 2024

cc #123610

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant