Uh oh!
There was an error while loading. Please reload this page.
Inline ptr::null(_mut) even in debug builds - #64996
Conversation
rust-highfive
commented
Oct 2, 2019
r? @Kimundi (rust_highfive has picked a reviewer for you, use r? to override) |
tesuji
commented
Oct 2, 2019
r? @eddyb |
eddyb
commented
Oct 2, 2019
nagisa
commented
Oct 2, 2019
I am amused that we do not "just" evaluate |
nagisa
commented
Oct 2, 2019
IIRC if there is code that uses |
That would surprise me a lot. I know for sure though that we run the AlwaysInline pass at -O0. This explains why the inlining happens and also why there is a pointless jump in the godbolt output (at -O1 that is cleaned up, presumably by SimplifyCFG). |
nagisa
commented
Oct 2, 2019
Eeh, my memory failed me then. |
nagisa
commented
Oct 2, 2019
@oli-obk any ideas why |
eddyb
commented
Oct 3, 2019
I think this would fit nicely into my recent suggestion to treat no-argument Also, does the constant folding MIR pass handle |
tesuji
commented
Oct 6, 2019
r? @oli-obk |
JohnCSimon
commented
Oct 12, 2019
Always inline `mem::{size_of,align_of}` in debug builds
Those two are const fn and do not have any arguments. Inlining
helps reducing generated code size in debug builds.
See also rust-lang#64996.Always inline `mem::{size_of,align_of}` in debug builds
Those two are const fn and do not have any arguments. Inlining
helps reducing generated code size in debug builds.
See also rust-lang#64996.oli-obk
commented
Oct 19, 2019
@bors r+ rollup Let's do this until const prop can handle function calls |
bors
commented
Oct 19, 2019
📌 Commit d0862ec has been approved by |
Inline `ptr::null(_mut)` even in debug builds I think we should treat `ptr::null(_mut)` as a constant. As It may help reduce code size in debug build. See godbolt link: https://godbolt.org/z/b9YMtD
Inline `ptr::null(_mut)` even in debug builds I think we should treat `ptr::null(_mut)` as a constant. As It may help reduce code size in debug build. See godbolt link: https://godbolt.org/z/b9YMtD
Rollup of 6 pull requests Successful merges: - #64996 (Inline `ptr::null(_mut)` even in debug builds) - #65551 (Avoid realloc in `CString::new`) - #65593 (add test for calling non-const fn) - #65595 (move `parse_cfgspecs` to `rustc_interface`) - #65600 (Remove unneeded `ref` from docs) - #65602 (Fix plural mistake in emitter.rs) Failed merges: r? @ghost
I think we should treat
ptr::null(_mut)as a constant. As It may help reduce code sizein debug build.
See godbolt link: https://godbolt.org/z/b9YMtD