@@ -21,7 +21,7 @@ use self::operand::{OperandRef, OperandValue};
21
21
pub struct FunctionCx < ' a , ' tcx , Bx : BuilderMethods < ' a , ' tcx > > {
22
22
instance : Instance < ' tcx > ,
23
23
24
- mir : mir:: ReadOnlyBodyAndCache < ' tcx , ' tcx > ,
24
+ mir : & ' tcx mir:: Body < ' tcx > ,
25
25
26
26
debug_context : Option < FunctionDebugContext < Bx :: DIScope > > ,
27
27
@@ -169,7 +169,6 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
169
169
. collect ( ) ;
170
170
171
171
let ( landing_pads, funclets) = create_funclets ( & mir, & mut bx, & cleanup_kinds, & block_bxs) ;
172
- let mir_body: & mir:: Body < ' _ > = * mir;
173
172
let mut fx = FunctionCx {
174
173
instance,
175
174
mir,
@@ -197,7 +196,7 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
197
196
let args = arg_local_refs ( & mut bx, & mut fx, & memory_locals) ;
198
197
199
198
let mut allocate_local = |local| {
200
- let decl = & mir_body . local_decls [ local] ;
199
+ let decl = & mir . local_decls [ local] ;
201
200
let layout = bx. layout_of ( fx. monomorphize ( & decl. ty ) ) ;
202
201
assert ! ( !layout. ty. has_erasable_regions( ) ) ;
203
202
@@ -223,7 +222,7 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
223
222
let retptr = allocate_local ( mir:: RETURN_PLACE ) ;
224
223
iter:: once ( retptr)
225
224
. chain ( args. into_iter ( ) )
226
- . chain ( mir_body . vars_and_temps_iter ( ) . map ( allocate_local) )
225
+ . chain ( mir . vars_and_temps_iter ( ) . map ( allocate_local) )
227
226
. collect ( )
228
227
} ;
229
228
@@ -235,8 +234,8 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
235
234
bx. br ( fx. blocks [ mir:: START_BLOCK ] ) ;
236
235
}
237
236
238
- let rpo = traversal:: reverse_postorder ( & mir_body ) ;
239
- let mut visited = BitSet :: new_empty ( mir_body . basic_blocks ( ) . len ( ) ) ;
237
+ let rpo = traversal:: reverse_postorder ( & mir ) ;
238
+ let mut visited = BitSet :: new_empty ( mir . basic_blocks ( ) . len ( ) ) ;
240
239
241
240
// Codegen the body of each block using reverse postorder
242
241
for ( bb, _) in rpo {
@@ -246,7 +245,7 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
246
245
247
246
// Remove blocks that haven't been visited, or have no
248
247
// predecessors.
249
- for bb in mir_body . basic_blocks ( ) . indices ( ) {
248
+ for bb in mir . basic_blocks ( ) . indices ( ) {
250
249
// Unreachable block
251
250
if !visited. contains ( bb. index ( ) ) {
252
251
debug ! ( "codegen_mir: block {:?} was not visited" , bb) ;
0 commit comments