Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#121300 - c410-f3r:perf-try, r=<try>
[Experiment] Eliminate possible `Vec::push` branches Related to rust-lang#105156. Requesting a perf run. ```rust pub fn push(v: &mut Vec<u8>) { let _ = v.reserve(4); v.push(1); v.push(2); v.push(3); v.push(4); } ``` AFAICT, the codegen backend should infer the infallibility of these `push`s but unfortunately with LLVM 18 we still have unnecessary `reserve_for_push` branches. For the sake of curiosity, `assert_unchecked` was included in `push` to see any potential impact of such change. Take a look at the generated assembly at https://godbolt.org/z/b5jjPhsf8. AFAICT (again), the assumption of more available capacity for each `push` is not valid for all situations.
- Loading branch information