@@ -21,7 +21,7 @@ use self::operand::{OperandRef, OperandValue};
2121pub struct FunctionCx < ' a , ' tcx , Bx : BuilderMethods < ' a , ' tcx > > {
2222 instance : Instance < ' tcx > ,
2323
24- mir : mir:: ReadOnlyBodyAndCache < ' tcx , ' tcx > ,
24+ mir : & ' tcx mir:: Body < ' tcx > ,
2525
2626 debug_context : Option < FunctionDebugContext < Bx :: DIScope > > ,
2727
@@ -169,7 +169,6 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
169169 . collect ( ) ;
170170
171171 let ( landing_pads, funclets) = create_funclets ( & mir, & mut bx, & cleanup_kinds, & block_bxs) ;
172- let mir_body: & mir:: Body < ' _ > = * mir;
173172 let mut fx = FunctionCx {
174173 instance,
175174 mir,
@@ -197,7 +196,7 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
197196 let args = arg_local_refs ( & mut bx, & mut fx, & memory_locals) ;
198197
199198 let mut allocate_local = |local| {
200- let decl = & mir_body . local_decls [ local] ;
199+ let decl = & mir . local_decls [ local] ;
201200 let layout = bx. layout_of ( fx. monomorphize ( & decl. ty ) ) ;
202201 assert ! ( !layout. ty. has_erasable_regions( ) ) ;
203202
@@ -223,7 +222,7 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
223222 let retptr = allocate_local ( mir:: RETURN_PLACE ) ;
224223 iter:: once ( retptr)
225224 . 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) )
227226 . collect ( )
228227 } ;
229228
@@ -235,8 +234,8 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
235234 bx. br ( fx. blocks [ mir:: START_BLOCK ] ) ;
236235 }
237236
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 ( ) ) ;
240239
241240 // Codegen the body of each block using reverse postorder
242241 for ( bb, _) in rpo {
@@ -246,7 +245,7 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
246245
247246 // Remove blocks that haven't been visited, or have no
248247 // predecessors.
249- for bb in mir_body . basic_blocks ( ) . indices ( ) {
248+ for bb in mir . basic_blocks ( ) . indices ( ) {
250249 // Unreachable block
251250 if !visited. contains ( bb. index ( ) ) {
252251 debug ! ( "codegen_mir: block {:?} was not visited" , bb) ;
0 commit comments