-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Inline ptr::null(_mut)
even in debug builds
#64996
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @Kimundi (rust_highfive has picked a reviewer for you, use r? to override) |
r? @eddyb |
I am amused that we do not "just" evaluate |
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). |
Eeh, my memory failed me then. |
@oli-obk any ideas why |
I think this would fit nicely into my recent suggestion to treat no-argument Also, does the constant folding MIR pass handle |
r? @oli-obk |
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.
@bors r+ rollup Let's do this until const prop can handle function calls |
📌 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