Open
Description
openedon Mar 29, 2024
Today, these
#[no_mangle]
pub fn replace_short_array_1(r: &mut [u32; 1], v: [u32; 1]) -> [u32; 1] { … }
#[no_mangle]
pub fn replace_short_array_2(r: &mut [u32; 2], v: [u32; 2]) -> [u32; 2] { … }
define i32 @replace_short_array_1(ptr noalias nocapture noundef align 4 dereferenceable(4) %r, i32 %0) unnamed_addr #0 { … }
define i64 @replace_short_array_2(ptr noalias nocapture noundef align 4 dereferenceable(8) %r, i64 %0) unnamed_addr #0 { … }
Note specifically how they have i32 %0
and i64 %0
-- that means we're not telling LLVM that the array must be initialized (non-undef and non-poison).
#106294 did this for normal scalars. For example if you change that first one to
#[no_mangle]
pub fn replace_short_array_1_alt(r: &mut [u32; 1], v: u32) -> [u32; 1] {
std::mem::replace(r, [v])
}
then you correctly get i32 noundef %v
.
It looks like it was just missed in some of the trickier ABI cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment