@@ -150,7 +150,6 @@ impl<'tcx> MirPatch<'tcx> {
150150
151151 let mut delta = 0 ;
152152 let mut last_bb = START_BLOCK ;
153- let mut stmts_and_targets: Vec < ( Statement < ' _ > , BasicBlock ) > = Vec :: new ( ) ;
154153 for ( mut loc, stmt) in new_statements {
155154 if loc. block != last_bb {
156155 delta = 0 ;
@@ -159,27 +158,11 @@ impl<'tcx> MirPatch<'tcx> {
159158 debug ! ( "MirPatch: adding statement {:?} at loc {:?}+{}" , stmt, loc, delta) ;
160159 loc. statement_index += delta;
161160 let source_info = Self :: source_info_for_index ( & body[ loc. block ] , loc) ;
162-
163- // For mir-opt `Derefer` to work in all cases we need to
164- // get terminator's targets and apply the statement to all of them.
165- if loc. statement_index > body[ loc. block ] . statements . len ( ) {
166- let term = body[ loc. block ] . terminator ( ) ;
167- for i in term. successors ( ) {
168- stmts_and_targets. push ( ( Statement { source_info, kind : stmt. clone ( ) } , i) ) ;
169- }
170- delta += 1 ;
171- continue ;
172- }
173-
174161 body[ loc. block ]
175162 . statements
176163 . insert ( loc. statement_index , Statement { source_info, kind : stmt } ) ;
177164 delta += 1 ;
178165 }
179-
180- for ( stmt, target) in stmts_and_targets. into_iter ( ) . rev ( ) {
181- body[ target] . statements . insert ( 0 , stmt) ;
182- }
183166 }
184167
185168 pub fn source_info_for_index ( data : & BasicBlockData < ' _ > , loc : Location ) -> SourceInfo {
0 commit comments