std: Improve codegen size of accessing TLS#55518
Conversation
|
r? @bluss (rust_highfive has picked a reviewer for you, use r? to override) |
|
r? @sfackler |
|
@bors r+ |
|
📌 Commit 62eec9ee4c523ead0f46f1a5e6e85460ef02bc1a has been approved by |
src/libstd/thread/local.rs
Outdated
There was a problem hiding this comment.
I think this really deserves a comment indicating why it was done -- could you add one? That way we can avoid confusion or cleanup removing this without knowing what to check
There was a problem hiding this comment.
Also don't we have unreachable_unchecked so that we do not have to call an intrinsic directly?
62eec9e to
36990de
Compare
|
@bors: r=sfackler |
|
📌 Commit 36990de9f160739bc56925d4e7036e13476300be has been approved by |
36990de to
f64efa5
Compare
|
@bors: r=sfackler |
|
📌 Commit f64efa5ea3607047aba695154767030da5abf3d4 has been approved by |
This comment has been minimized.
This comment has been minimized.
f64efa5 to
c24c2c9
Compare
|
@bors: r=sfackler |
|
📌 Commit c24c2c95f47f05eec17f3c4afbd981addb795fbf has been approved by |
|
@bors r- Failed in #55579 (comment) |
No need for this to actually show up in optimized non-LTO executables!
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.
|
💔 Test failed - status-appveyor |
|
@bors: retry Seems spurious ... |
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.
|
💔 Test failed - status-travis |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
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.
|
💔 Test failed - status-appveyor |
|
@bors: retry 3 hr timeout |
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.
|
☀️ Test successful - status-appveyor, status-travis |
Some code in the TLS implementation in libstd stores
Some(val)into an&mut Option<T>(effectively) and then pulls out&T, but it currentlyuses
.unwrap()which can codegen into a panic even though it can neverpanic. With sufficient optimizations enabled (like LTO) the compiler can
see through this but this commit helps it along in normal mode
(
--releasewith 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.