about summary refs log tree commit diff
path: root/compiler/rustc_builtin_macros/src/assert/context.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-06-14 21:37:11 +0000
committerbors <bors@rust-lang.org>2022-06-14 21:37:11 +0000
commit2d1e0750792529248ed6f11061940c7203d668c9 (patch)
tree354b2d33e105f927b0e0a25d509b56f003eb0597 /compiler/rustc_builtin_macros/src/assert/context.rs
parent1f34da9ec8a85b6f86c5fa1c121ab6f88f2f4966 (diff)
parent195f2082002c9db456e0fde8c1d5db79929ae293 (diff)
downloadrust-2d1e0750792529248ed6f11061940c7203d668c9.tar.gz
rust-2d1e0750792529248ed6f11061940c7203d668c9.zip
Auto merge of #96285 - flip1995:pk-vfe, r=nagisa
Introduce `-Zvirtual-function-elimination` codegen flag

Fixes #68262

This PR adds a codegen flag `-Zvirtual-function-elimination` to enable the VFE optimization in LLVM. To make this work, additonal  information has to be added to vtables ([`!vcall_visibility` metadata](https://llvm.org/docs/TypeMetadata.html#vcall-visibility-metadata) and a `typeid` of the trait). Furthermore, instead of just `load`ing functions, the [`llvm.type.checked.load` intrinsic](https://llvm.org/docs/LangRef.html#llvm-type-checked-load-intrinsic) has to be used to map functions to vtables.

For technical details of the changes, see the commit messages.

I also tested this flag on https://github.com/tock/tock on different boards to verify that this fixes the issue https://github.com/tock/tock/issues/2594. This flag is able to improve the size of the resulting binary by about 8k-9k bytes by removing the unused debug print functions.

[Rendered documentation update](https://github.com/flip1995/rust/blob/pk-vfe/src/doc/rustc/src/codegen-options/index.md#virtual-function-elimination)
Diffstat (limited to 'compiler/rustc_builtin_macros/src/assert/context.rs')
0 files changed, 0 insertions, 0 deletions