MaybeUninit::assume_init_read
should have noundef
load metadata
I was looking into `array::IntoIter` optimization, and noticed that it wasn't annotating the loads with `noundef` for simple things like `array::IntoIter<i32, N>`. Turned out to be a more general problem as `MaybeUninit::assume_init_read` isn't marking the load as initialized (<https://rust.godbolt.org/z/Mxd8TPTnv>), which is unfortunate since that's basically its reason to exist. This PR lowers `ptr::read(p)` to `copy *p` in MIR, which fortuitiously also improves the IR we give to LLVM for things like `mem::replace`.
This commit is contained in:
parent
19c53768af
commit
b2c717fa33
14 changed files with 214 additions and 39 deletions
|
@ -1153,6 +1153,7 @@ symbols! {
|
|||
read_enum_variant_arg,
|
||||
read_struct,
|
||||
read_struct_field,
|
||||
read_via_copy,
|
||||
readonly,
|
||||
realloc,
|
||||
reason,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue