Skip to content

Commit

Permalink
Add pass names to some common dataflow analyses
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Sep 15, 2020
1 parent 8e3ce43 commit 0475c36
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_mir/src/borrow_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ fn do_mir_borrowck<'a, 'tcx>(

let mut flow_inits = MaybeInitializedPlaces::new(tcx, &body, &mdpe)
.into_engine(tcx, &body, def.did.to_def_id())
.pass_name("borrowck")
.iterate_to_fixpoint()
.into_results_cursor(&body);

Expand Down Expand Up @@ -264,12 +265,15 @@ fn do_mir_borrowck<'a, 'tcx>(

let flow_borrows = Borrows::new(tcx, &body, regioncx.clone(), &borrow_set)
.into_engine(tcx, &body, def.did.to_def_id())
.pass_name("borrowck")
.iterate_to_fixpoint();
let flow_uninits = MaybeUninitializedPlaces::new(tcx, &body, &mdpe)
.into_engine(tcx, &body, def.did.to_def_id())
.pass_name("borrowck")
.iterate_to_fixpoint();
let flow_ever_inits = EverInitializedPlaces::new(tcx, &body, &mdpe)
.into_engine(tcx, &body, def.did.to_def_id())
.pass_name("borrowck")
.iterate_to_fixpoint();

let movable_generator = match tcx.hir().get(id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ impl Qualifs<'mir, 'tcx> {
MaybeMutBorrowedLocals::mut_borrows_only(tcx, &body, param_env)
.unsound_ignore_borrow_on_drop()
.into_engine(tcx, &body, def_id.to_def_id())
.pass_name("const_qualification")
.iterate_to_fixpoint()
.into_results_cursor(&body)
});
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_mir/src/transform/elaborate_drops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ impl<'tcx> MirPass<'tcx> for ElaborateDrops {
let inits = MaybeInitializedPlaces::new(tcx, body, &env)
.into_engine(tcx, body, def_id)
.dead_unwinds(&dead_unwinds)
.pass_name("elaborate_drops")
.iterate_to_fixpoint()
.into_results_cursor(body);

let uninits = MaybeUninitializedPlaces::new(tcx, body, &env)
.mark_inactive_variants_as_uninit()
.into_engine(tcx, body, def_id)
.dead_unwinds(&dead_unwinds)
.pass_name("elaborate_drops")
.iterate_to_fixpoint()
.into_results_cursor(body);

Expand Down Expand Up @@ -83,6 +85,7 @@ fn find_dead_unwinds<'tcx>(
let mut dead_unwinds = BitSet::new_empty(body.basic_blocks().len());
let mut flow_inits = MaybeInitializedPlaces::new(tcx, body, &env)
.into_engine(tcx, body, def_id)
.pass_name("find_dead_unwinds")
.iterate_to_fixpoint()
.into_results_cursor(body);
for (bb, bb_data) in body.basic_blocks().iter_enumerated() {
Expand Down
7 changes: 5 additions & 2 deletions compiler/rustc_mir/src/transform/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,10 @@ fn locals_live_across_suspend_points(

// Calculate the MIR locals which have been previously
// borrowed (even if they are still active).
let borrowed_locals_results =
MaybeBorrowedLocals::all_borrows().into_engine(tcx, body_ref, def_id).iterate_to_fixpoint();
let borrowed_locals_results = MaybeBorrowedLocals::all_borrows()
.into_engine(tcx, body_ref, def_id)
.pass_name("generator")
.iterate_to_fixpoint();

let mut borrowed_locals_cursor =
dataflow::ResultsCursor::new(body_ref, &borrowed_locals_results);
Expand All @@ -484,6 +486,7 @@ fn locals_live_across_suspend_points(
// Calculate the liveness of MIR locals ignoring borrows.
let mut liveness = MaybeLiveLocals
.into_engine(tcx, body_ref, def_id)
.pass_name("generator")
.iterate_to_fixpoint()
.into_results_cursor(body_ref);

Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/clippy_lints/src/redundant_clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClone {

let maybe_storage_live_result = MaybeStorageLive
.into_engine(cx.tcx, mir, def_id.to_def_id())
.pass_name("redundant_clone")
.iterate_to_fixpoint()
.into_results_cursor(mir);
let mut possible_borrower = {
Expand Down

0 comments on commit 0475c36

Please sign in to comment.