Open peterwmwong opened 2 months ago
I know this is a "minimal reduction" but is there an example where this impacts actual programs?
For reference, the actual cause, as far as I can tell, is this line in the alloc
function.
// Make sure we don't accidentally allow omitting the allocator shim in
// stable code until it is actually stabilized.
core::ptr::read_volatile(&__rust_no_alloc_shim_is_unstable);
It, of course, can't be optimized out because it's volatile.
That line doesn't appear in alloc_zeroed
, for some reason. (Maybe a bug?)
Just noticed a helpful rundown of the cause, why, and perf potential if fixed (@Kobzol's perf run) in this zulip conversation
Would you count this as fixed if we make the codegen match by regressing the good case? https://github.com/rust-lang/rust/pull/130497
Bold move @saethlin 😆. I've updated bug description/repro.
Y'all do whatever you want with this, just an observation I made a while back looking into Mojo's claims being faster than Rust.
Consider the following minimized example:
Expected generated output (Rust 1.81.0):
Actual output (Rust Nightly):
Godbolt: https://www.godbolt.org/z/x458Pv8P5