Skip to content

Commit ad5a6e1

Browse files
committed
Remove Allocations.
It's not necessary, and just complicates things.
1 parent 0a282ea commit ad5a6e1

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

compiler/rustc_mir_transform/src/dest_prop.rs

+4-14
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation {
164164

165165
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
166166
let def_id = body.source.def_id();
167-
let mut allocations = Allocations::default();
167+
let mut candidates = FxIndexMap::default();
168+
let mut candidates_reverse = FxIndexMap::default();
168169
let mut write_info = WriteInfo::default();
169170
trace!(func = ?tcx.def_path_str(def_id));
170171

@@ -196,8 +197,8 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation {
196197
let mut candidates = find_candidates(
197198
body,
198199
&borrowed,
199-
&mut allocations.candidates,
200-
&mut allocations.candidates_reverse,
200+
&mut candidates,
201+
&mut candidates_reverse,
201202
);
202203
trace!(?candidates);
203204
dest_prop_mir_dump(tcx, body, &points, &live, round_count);
@@ -255,17 +256,6 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation {
255256
}
256257
}
257258

258-
/// Container for the various allocations that we need.
259-
///
260-
/// We store these here and hand out `&mut` access to them, instead of dropping and recreating them
261-
/// frequently. Everything with a `&'alloc` lifetime points into here.
262-
#[derive(Default)]
263-
struct Allocations {
264-
candidates: FxIndexMap<Local, Vec<Local>>,
265-
candidates_reverse: FxIndexMap<Local, Vec<Local>>,
266-
// PERF: Do this for `MaybeLiveLocals` allocations too.
267-
}
268-
269259
#[derive(Debug)]
270260
struct Candidates<'alloc> {
271261
/// The set of candidates we are considering in this optimization.

0 commit comments

Comments
 (0)