about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2021-01-12 07:59:08 +0900
committerGitHub <noreply@github.com>2021-01-12 07:59:08 +0900
commit56504a00f2ea183653beb0a06393343c99cdf6e2 (patch)
tree039356279174b4cc8a439391c93563ec66d346cb /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parentedcfe7b6296aff0cf5c52f0c8bc972b0b156616d (diff)
parent4721b6518ce9c8e3a452af07c6dd178fbb83ab16 (diff)
downloadrust-56504a00f2ea183653beb0a06393343c99cdf6e2.tar.gz
rust-56504a00f2ea183653beb0a06393343c99cdf6e2.zip
Rollup merge of #80042 - sivadeilra:cold_bits, r=oli-obk
Split a func into cold/hot parts, reducing binary size

I noticed that the Size::bits function is called in many places,
and is inlined into them. On x86_64-pc-windows-msvc, this function
is inlined 527 times, and compiled separately (non-inlined) 3 times.

Each of those inlined calls contains code that panics. This commit
moves the `panic!` call into a separate function and marks that
function with `#[cold]`.

This reduces binary size by 24 KB. Not much, but it's something.
Changes like this often reduce pressure on instruction-caches,
since it reduces the amount of code that is inlined into hot code
paths. Or more precisely, it removes cold code from hot cache lines.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions