@@ -610,35 +610,13 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
610610 } ;
611611 let upvar_tys = upvar_substs. upvar_tys ( def_id, tcx) ;
612612
613- // Store the pointer to closure data in an alloca for debuginfo
614- // because that's what the llvm.dbg.declare intrinsic expects.
615-
616- // FIXME(eddyb) this shouldn't be necessary but SROA seems to
617- // mishandle DW_OP_plus not preceded by DW_OP_deref, i.e., it
618- // doesn't actually strip the offset when splitting the closure
619- // environment into its components so it ends up out of bounds.
620- // (cuviper) It seems to be fine without the alloca on LLVM 6 and later.
621- let env_alloca = !env_ref && bx. closure_env_needs_indirect_debuginfo ( ) ;
622- let env_ptr = if env_alloca {
623- let scratch = PlaceRef :: alloca ( bx,
624- bx. layout_of ( tcx. mk_mut_ptr ( arg. layout . ty ) ) ,
625- "__debuginfo_env_ptr" ) ;
626- bx. store ( place. llval , scratch. llval , scratch. align ) ;
627- scratch. llval
628- } else {
629- place. llval
630- } ;
631-
632613 for ( i, ( decl, ty) ) in mir. upvar_decls . iter ( ) . zip ( upvar_tys) . enumerate ( ) {
633614 let byte_offset_of_var_in_env = closure_layout. fields . offset ( i) . bytes ( ) ;
634615
635616 let ops = bx. debuginfo_upvar_decls_ops_sequence ( byte_offset_of_var_in_env) ;
636617
637618 // The environment and the capture can each be indirect.
638-
639- // FIXME(eddyb) see above why we sometimes have to keep
640- // a pointer in an alloca for debuginfo atm.
641- let mut ops = if env_ref || env_alloca { & ops[ ..] } else { & ops[ 1 ..] } ;
619+ let mut ops = if env_ref { & ops[ ..] } else { & ops[ 1 ..] } ;
642620
643621 let ty = if let ( true , & ty:: Ref ( _, ty, _) ) = ( decl. by_ref , & ty. sty ) {
644622 ty
@@ -648,7 +626,7 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
648626 } ;
649627
650628 let variable_access = VariableAccess :: IndirectVariable {
651- alloca : env_ptr ,
629+ alloca : place . llval ,
652630 address_operations : & ops
653631 } ;
654632 bx. declare_local (
0 commit comments