Open
Description
I tried this code:
pub fn zzz(v: &mut Vec<u8>, s: &[u8]) {
v.reserve(s.len());
v.extend_from_slice(s);
}
I expected to see this happen: only one do_reserve_and_handle
call.
Instead, this happened: extend_from_slice
stills checks the capacity and calls reserve. It seems like LLVM assumes aren't able to bubble up out of multiple functions. I was able to get the optimization to work in #119465 but it required putting assumes in every function along the reserve chain.