Skip to content

Commit

Permalink
Move WriteInfo out of Allocations.
Browse files Browse the repository at this point in the history
It doesn't need to be in there, and the move simplifies lifetimes.
  • Loading branch information
nnethercote committed Aug 29, 2024
1 parent c6111c0 commit 0a282ea
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions compiler/rustc_mir_transform/src/dest_prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ 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 write_info = WriteInfo::default();
trace!(func = ?tcx.def_path_str(def_id));

let borrowed = rustc_mir_dataflow::impls::borrowed_locals(body);
Expand Down Expand Up @@ -205,7 +206,7 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation {
&mut candidates,
&points,
&live,
&mut allocations.write_info,
&mut write_info,
body,
);

Expand Down Expand Up @@ -262,7 +263,6 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation {
struct Allocations {
candidates: FxIndexMap<Local, Vec<Local>>,
candidates_reverse: FxIndexMap<Local, Vec<Local>>,
write_info: WriteInfo,
// PERF: Do this for `MaybeLiveLocals` allocations too.
}

Expand Down Expand Up @@ -364,7 +364,7 @@ struct FilterInformation<'a, 'alloc, 'tcx> {
points: &'a DenseLocationMap,
live: &'a SparseIntervalMatrix<Local, PointIndex>,
candidates: &'a mut Candidates<'alloc>,
write_info: &'alloc mut WriteInfo,
write_info: &'a mut WriteInfo,
at: Location,
}

Expand Down Expand Up @@ -468,7 +468,7 @@ impl<'a, 'alloc, 'tcx> FilterInformation<'a, 'alloc, 'tcx> {
candidates: &mut Candidates<'alloc>,
points: &DenseLocationMap,
live: &SparseIntervalMatrix<Local, PointIndex>,
write_info: &'alloc mut WriteInfo,
write_info: &mut WriteInfo,
body: &Body<'tcx>,
) {
let mut this = FilterInformation {
Expand Down

0 comments on commit 0a282ea

Please sign in to comment.