@@ -7,9 +7,7 @@ use rustc_data_structures::graph::dominators::Dominators;
77use rustc_index:: bit_set:: BitSet ;
88use rustc_index:: vec:: { Idx , IndexVec } ;
99use rustc_middle:: mir:: traversal;
10- use rustc_middle:: mir:: visit:: {
11- MutatingUseContext , NonMutatingUseContext , NonUseContext , PlaceContext , Visitor ,
12- } ;
10+ use rustc_middle:: mir:: visit:: { MutatingUseContext , NonMutatingUseContext , PlaceContext , Visitor } ;
1311use rustc_middle:: mir:: { self , Location , TerminatorKind } ;
1412use rustc_middle:: ty;
1513use rustc_middle:: ty:: layout:: HasTyCtxt ;
@@ -21,7 +19,9 @@ pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
2119 let mir = fx. mir ;
2220 let mut analyzer = LocalAnalyzer :: new ( fx) ;
2321
24- analyzer. visit_body ( & mir) ;
22+ for ( bb, data) in mir. basic_blocks ( ) . iter_enumerated ( ) {
23+ analyzer. visit_basic_block_data ( bb, data) ;
24+ }
2525
2626 for ( local, decl) in mir. local_decls . iter_enumerated ( ) {
2727 let ty = fx. monomorphize ( decl. ty ) ;
@@ -142,36 +142,7 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
142142
143143 if let mir:: ProjectionElem :: Deref = elem {
144144 // Deref projections typically only read the pointer.
145- // (the exception being `VarDebugInfo` contexts, handled below)
146145 base_context = PlaceContext :: NonMutatingUse ( NonMutatingUseContext :: Copy ) ;
147-
148- // Indirect debuginfo requires going through memory, that only
149- // the debugger accesses, following our emitted DWARF pointer ops.
150- //
151- // FIXME(eddyb) Investigate the possibility of relaxing this, but
152- // note that `llvm.dbg.declare` *must* be used for indirect places,
153- // even if we start using `llvm.dbg.value` for all other cases,
154- // as we don't necessarily know when the value changes, but only
155- // where it lives in memory.
156- //
157- // It's possible `llvm.dbg.declare` could support starting from
158- // a pointer that doesn't point to an `alloca`, but this would
159- // only be useful if we know the pointer being `Deref`'d comes
160- // from an immutable place, and if `llvm.dbg.declare` calls
161- // must be at the very start of the function, then only function
162- // arguments could contain such pointers.
163- if context == PlaceContext :: NonUse ( NonUseContext :: VarDebugInfo ) {
164- // We use `NonUseContext::VarDebugInfo` for the base,
165- // which might not force the base local to memory,
166- // so we have to do it manually.
167- self . visit_local ( & place_ref. local , context, location) ;
168- }
169- }
170-
171- // `NonUseContext::VarDebugInfo` needs to flow all the
172- // way down to the base local (see `visit_local`).
173- if context == PlaceContext :: NonUse ( NonUseContext :: VarDebugInfo ) {
174- base_context = context;
175146 }
176147
177148 self . process_place ( & place_base, base_context, location) ;
0 commit comments