]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #55518 - alexcrichton:smaller-wasm, r=sfackler
authorbors <bors@rust-lang.org>
Tue, 6 Nov 2018 04:04:33 +0000 (04:04 +0000)
committerbors <bors@rust-lang.org>
Tue, 6 Nov 2018 04:04:33 +0000 (04:04 +0000)
std: Improve codegen size of accessing TLS

Some code in the TLS implementation in libstd stores `Some(val)` into an
`&mut Option<T>` (effectively) and then pulls out `&T`, but it currently
uses `.unwrap()` which can codegen into a panic even though it can never
panic. With sufficient optimizations enabled (like LTO) the compiler can
see through this but this commit helps it along in normal mode
(`--release` with Cargo by default) to avoid codegen'ing the panic path.

This ends up improving the optimized codegen on wasm by ensuring that a
call to panic pulling in more file size doesn't stick around.


Trivial merge