@@ -583,23 +583,6 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
583
583
} ;
584
584
let upvar_tys = upvar_substs. upvar_tys ( def_id, tcx) ;
585
585
586
- // Store the pointer to closure data in an alloca for debuginfo
587
- // because that's what the llvm.dbg.declare intrinsic expects.
588
-
589
- // FIXME(eddyb) this shouldn't be necessary but SROA seems to
590
- // mishandle DW_OP_plus not preceded by DW_OP_deref, i.e. it
591
- // doesn't actually strip the offset when splitting the closure
592
- // environment into its components so it ends up out of bounds.
593
- let env_ptr = if !env_ref {
594
- let scratch = PlaceRef :: alloca ( bx,
595
- bx. cx . layout_of ( tcx. mk_mut_ptr ( arg. layout . ty ) ) ,
596
- "__debuginfo_env_ptr" ) ;
597
- bx. store ( place. llval , scratch. llval , scratch. align ) ;
598
- scratch. llval
599
- } else {
600
- place. llval
601
- } ;
602
-
603
586
for ( i, ( decl, ty) ) in mir. upvar_decls . iter ( ) . zip ( upvar_tys) . enumerate ( ) {
604
587
let byte_offset_of_var_in_env = closure_layout. fields . offset ( i) . bytes ( ) ;
605
588
@@ -611,10 +594,7 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
611
594
} ;
612
595
613
596
// The environment and the capture can each be indirect.
614
-
615
- // FIXME(eddyb) see above why we have to keep
616
- // a pointer in an alloca for debuginfo atm.
617
- let mut ops = if env_ref || true { & ops[ ..] } else { & ops[ 1 ..] } ;
597
+ let mut ops = if env_ref { & ops[ ..] } else { & ops[ 1 ..] } ;
618
598
619
599
let ty = if let ( true , & ty:: TyRef ( _, ty, _) ) = ( decl. by_ref , & ty. sty ) {
620
600
ty
@@ -624,7 +604,7 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
624
604
} ;
625
605
626
606
let variable_access = VariableAccess :: IndirectVariable {
627
- alloca : env_ptr ,
607
+ alloca : place . llval ,
628
608
address_operations : & ops
629
609
} ;
630
610
declare_local (
0 commit comments