@@ -150,7 +150,6 @@ impl<'tcx> MirPatch<'tcx> {
150
150
151
151
let mut delta = 0 ;
152
152
let mut last_bb = START_BLOCK ;
153
- let mut stmts_and_targets: Vec < ( Statement < ' _ > , BasicBlock ) > = Vec :: new ( ) ;
154
153
for ( mut loc, stmt) in new_statements {
155
154
if loc. block != last_bb {
156
155
delta = 0 ;
@@ -159,27 +158,11 @@ impl<'tcx> MirPatch<'tcx> {
159
158
debug ! ( "MirPatch: adding statement {:?} at loc {:?}+{}" , stmt, loc, delta) ;
160
159
loc. statement_index += delta;
161
160
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
-
174
161
body[ loc. block ]
175
162
. statements
176
163
. insert ( loc. statement_index , Statement { source_info, kind : stmt } ) ;
177
164
delta += 1 ;
178
165
}
179
-
180
- for ( stmt, target) in stmts_and_targets. into_iter ( ) . rev ( ) {
181
- body[ target] . statements . insert ( 0 , stmt) ;
182
- }
183
166
}
184
167
185
168
pub fn source_info_for_index ( data : & BasicBlockData < ' _ > , loc : Location ) -> SourceInfo {
0 commit comments