diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-08-29 11:30:12 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-08-29 12:00:40 +1000 |
| commit | ad5a6e11c75905a51146f1cd0bb036ebe7c01a29 (patch) | |
| tree | 35d33199b41674d360ffe79462d859f0dc49766a | |
| parent | 0a282ea7176b000928654262d3faa67785722398 (diff) | |
| download | rust-ad5a6e11c75905a51146f1cd0bb036ebe7c01a29.tar.gz rust-ad5a6e11c75905a51146f1cd0bb036ebe7c01a29.zip | |
Remove `Allocations`.
It's not necessary, and just complicates things.
| -rw-r--r-- | compiler/rustc_mir_transform/src/dest_prop.rs | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/compiler/rustc_mir_transform/src/dest_prop.rs b/compiler/rustc_mir_transform/src/dest_prop.rs index f7057b0a6ab..f5f496acfce 100644 --- a/compiler/rustc_mir_transform/src/dest_prop.rs +++ b/compiler/rustc_mir_transform/src/dest_prop.rs @@ -164,7 +164,8 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation { fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { let def_id = body.source.def_id(); - let mut allocations = Allocations::default(); + let mut candidates = FxIndexMap::default(); + let mut candidates_reverse = FxIndexMap::default(); let mut write_info = WriteInfo::default(); trace!(func = ?tcx.def_path_str(def_id)); @@ -196,8 +197,8 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation { let mut candidates = find_candidates( body, &borrowed, - &mut allocations.candidates, - &mut allocations.candidates_reverse, + &mut candidates, + &mut candidates_reverse, ); trace!(?candidates); dest_prop_mir_dump(tcx, body, &points, &live, round_count); @@ -255,17 +256,6 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation { } } -/// Container for the various allocations that we need. -/// -/// We store these here and hand out `&mut` access to them, instead of dropping and recreating them -/// frequently. Everything with a `&'alloc` lifetime points into here. -#[derive(Default)] -struct Allocations { - candidates: FxIndexMap<Local, Vec<Local>>, - candidates_reverse: FxIndexMap<Local, Vec<Local>>, - // PERF: Do this for `MaybeLiveLocals` allocations too. -} - #[derive(Debug)] struct Candidates<'alloc> { /// The set of candidates we are considering in this optimization. |
