diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2024-06-21 02:20:18 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2024-06-21 18:02:05 -0700 |
| commit | b28efb11af6c3aea1117df81df9fc6ddf5b88077 (patch) | |
| tree | 0b7ee85999c65aab801e636ff4284f32cb5f0933 /compiler/rustc_mir_transform/src/instsimplify.rs | |
| parent | 25c9f2ca06d6d8d5f314362ffd17e71a8df55546 (diff) | |
| download | rust-b28efb11af6c3aea1117df81df9fc6ddf5b88077.tar.gz rust-b28efb11af6c3aea1117df81df9fc6ddf5b88077.zip | |
Save 2 pointers in `TerminatorKind` (96 → 80 bytes)
These things don't need to be `Vec`s; boxed slices are enough. The frequent one here is call arguments, but MIR building knows the number of arguments from the THIR, so the collect is always getting the allocation right in the first place, and thus this shouldn't ever add the shrink-in-place overhead.
Diffstat (limited to 'compiler/rustc_mir_transform/src/instsimplify.rs')
| -rw-r--r-- | compiler/rustc_mir_transform/src/instsimplify.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_mir_transform/src/instsimplify.rs b/compiler/rustc_mir_transform/src/instsimplify.rs index 6806c517c17..8209e5e2711 100644 --- a/compiler/rustc_mir_transform/src/instsimplify.rs +++ b/compiler/rustc_mir_transform/src/instsimplify.rs @@ -1,6 +1,7 @@ //! Performs various peephole optimizations. use crate::simplify::simplify_duplicate_switch_targets; +use crate::take_array; use rustc_ast::attr; use rustc_middle::bug; use rustc_middle::mir::*; @@ -285,7 +286,8 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> { return; } - let Some(arg_place) = args.pop().unwrap().node.place() else { return }; + let Ok([arg]) = take_array(args) else { return }; + let Some(arg_place) = arg.node.place() else { return }; statements.push(Statement { source_info: terminator.source_info, |
