Remove Allocations
.
It's not necessary, and just complicates things.
This commit is contained in:
parent
0a282ea717
commit
ad5a6e11c7
1 changed files with 4 additions and 14 deletions
|
@ -164,7 +164,8 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation {
|
||||||
|
|
||||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||||
let def_id = body.source.def_id();
|
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();
|
let mut write_info = WriteInfo::default();
|
||||||
trace!(func = ?tcx.def_path_str(def_id));
|
trace!(func = ?tcx.def_path_str(def_id));
|
||||||
|
|
||||||
|
@ -196,8 +197,8 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation {
|
||||||
let mut candidates = find_candidates(
|
let mut candidates = find_candidates(
|
||||||
body,
|
body,
|
||||||
&borrowed,
|
&borrowed,
|
||||||
&mut allocations.candidates,
|
&mut candidates,
|
||||||
&mut allocations.candidates_reverse,
|
&mut candidates_reverse,
|
||||||
);
|
);
|
||||||
trace!(?candidates);
|
trace!(?candidates);
|
||||||
dest_prop_mir_dump(tcx, body, &points, &live, round_count);
|
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)]
|
#[derive(Debug)]
|
||||||
struct Candidates<'alloc> {
|
struct Candidates<'alloc> {
|
||||||
/// The set of candidates we are considering in this optimization.
|
/// The set of candidates we are considering in this optimization.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue