]> git.lizzy.rs Git - rust.git/commitdiff
Add pass names to some common dataflow analyses
authorDylan MacKenzie <ecstaticmorse@gmail.com>
Tue, 15 Sep 2020 00:13:47 +0000 (17:13 -0700)
committerDylan MacKenzie <ecstaticmorse@gmail.com>
Tue, 15 Sep 2020 00:56:39 +0000 (17:56 -0700)
compiler/rustc_mir/src/borrow_check/mod.rs
compiler/rustc_mir/src/transform/check_consts/validation.rs
compiler/rustc_mir/src/transform/elaborate_drops.rs
compiler/rustc_mir/src/transform/generator.rs
src/tools/clippy/clippy_lints/src/redundant_clone.rs

index acd9e3dcf3fcd44a40343908ad7d71c80c192482..a6f06fee3b27be76d232fc12cd6141435f938e07 100644 (file)
@@ -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);
 
@@ -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) {
index e8411b121e394b59e81aa1f49a17c49e346a46e0..ef306813825f5b1bed3ee5ac118a523e358e25fe 100644 (file)
@@ -57,6 +57,7 @@ pub fn indirectly_mutable(
             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)
         });
index 5f1930693568cc83a8d8a9c8c9adb313738d3f65..a8b2ee5705f1f16590bae7f2e681f0ca1e3cd272 100644 (file)
@@ -44,6 +44,7 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx
             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);
 
@@ -51,6 +52,7 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx
                 .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);
 
@@ -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() {
index 78cedec502007a697e357a144e3e5cea8ce403e8..1fffcf81515377dcc039e80e1bb863c5de6b7f2e 100644 (file)
@@ -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);
@@ -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);
 
index 57a45e628db61497c3f605838e75f2e220a8a003..1615f19237096f4c2816a28673f53b6012fdbd96 100644 (file)
@@ -87,6 +87,7 @@ fn check_fn(
 
         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 = {