about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorArlie Davis <ardavis@microsoft.com>2020-12-14 15:45:19 -0800
committerArlie Davis <ardavis@microsoft.com>2021-01-05 12:52:34 -0800
commit4721b6518ce9c8e3a452af07c6dd178fbb83ab16 (patch)
treebecbe37ac46d3888a9011381dee87207018bedc3 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent3b63e16552bbc3bfdddad67ba219455a2a3ac03c (diff)
downloadrust-4721b6518ce9c8e3a452af07c6dd178fbb83ab16.tar.gz
rust-4721b6518ce9c8e3a452af07c6dd178fbb83ab16.zip
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. By itself, that's not a substantial
reduction. However, 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. It also removes all conditionals from Size::bits(),
which is called in many places.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions