about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2022-07-30 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2022-08-23 10:08:48 +0200
commitc2b74f9cc71d0d53a1f7c34070bde1df4bb31dfb (patch)
tree282c9527ffaed771cdde711da1208385a2e3822d
parent625af2cc7595e0908f4b557f59010f2eeda67de7 (diff)
downloadrust-c2b74f9cc71d0d53a1f7c34070bde1df4bb31dfb.tar.gz
rust-c2b74f9cc71d0d53a1f7c34070bde1df4bb31dfb.zip
Remove support for adding statement to all successors
This feature of MIR patch system is no longer used.
-rw-r--r--compiler/rustc_middle/src/mir/patch.rs17
1 files changed, 0 insertions, 17 deletions
diff --git a/compiler/rustc_middle/src/mir/patch.rs b/compiler/rustc_middle/src/mir/patch.rs
index 906ce8d0906..8aa761aae8d 100644
--- a/compiler/rustc_middle/src/mir/patch.rs
+++ b/compiler/rustc_middle/src/mir/patch.rs
@@ -150,7 +150,6 @@ impl<'tcx> MirPatch<'tcx> {
 
         let mut delta = 0;
         let mut last_bb = START_BLOCK;
-        let mut stmts_and_targets: Vec<(Statement<'_>, BasicBlock)> = Vec::new();
         for (mut loc, stmt) in new_statements {
             if loc.block != last_bb {
                 delta = 0;
@@ -159,27 +158,11 @@ impl<'tcx> MirPatch<'tcx> {
             debug!("MirPatch: adding statement {:?} at loc {:?}+{}", stmt, loc, delta);
             loc.statement_index += delta;
             let source_info = Self::source_info_for_index(&body[loc.block], loc);
-
-            // For mir-opt `Derefer` to work in all cases we need to
-            // get terminator's targets and apply the statement to all of them.
-            if loc.statement_index > body[loc.block].statements.len() {
-                let term = body[loc.block].terminator();
-                for i in term.successors() {
-                    stmts_and_targets.push((Statement { source_info, kind: stmt.clone() }, i));
-                }
-                delta += 1;
-                continue;
-            }
-
             body[loc.block]
                 .statements
                 .insert(loc.statement_index, Statement { source_info, kind: stmt });
             delta += 1;
         }
-
-        for (stmt, target) in stmts_and_targets.into_iter().rev() {
-            body[target].statements.insert(0, stmt);
-        }
     }
 
     pub fn source_info_for_index(data: &BasicBlockData<'_>, loc: Location) -> SourceInfo {