@@ -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:: layout:: HasTyCtxt ;
1513use rustc_target:: abi:: LayoutOf ;
@@ -20,7 +18,9 @@ pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
2018 let mir = fx. mir ;
2119 let mut analyzer = LocalAnalyzer :: new ( fx) ;
2220
23- analyzer. visit_body ( & mir) ;
21+ for ( bb, data) in mir. basic_blocks ( ) . iter_enumerated ( ) {
22+ analyzer. visit_basic_block_data ( bb, data) ;
23+ }
2424
2525 for ( local, decl) in mir. local_decls . iter_enumerated ( ) {
2626 let ty = fx. monomorphize ( decl. ty ) ;
@@ -141,36 +141,7 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
141141
142142 if let mir:: ProjectionElem :: Deref = elem {
143143 // Deref projections typically only read the pointer.
144- // (the exception being `VarDebugInfo` contexts, handled below)
145144 base_context = PlaceContext :: NonMutatingUse ( NonMutatingUseContext :: Copy ) ;
146-
147- // Indirect debuginfo requires going through memory, that only
148- // the debugger accesses, following our emitted DWARF pointer ops.
149- //
150- // FIXME(eddyb) Investigate the possibility of relaxing this, but
151- // note that `llvm.dbg.declare` *must* be used for indirect places,
152- // even if we start using `llvm.dbg.value` for all other cases,
153- // as we don't necessarily know when the value changes, but only
154- // where it lives in memory.
155- //
156- // It's possible `llvm.dbg.declare` could support starting from
157- // a pointer that doesn't point to an `alloca`, but this would
158- // only be useful if we know the pointer being `Deref`'d comes
159- // from an immutable place, and if `llvm.dbg.declare` calls
160- // must be at the very start of the function, then only function
161- // arguments could contain such pointers.
162- if context == PlaceContext :: NonUse ( NonUseContext :: VarDebugInfo ) {
163- // We use `NonUseContext::VarDebugInfo` for the base,
164- // which might not force the base local to memory,
165- // so we have to do it manually.
166- self . visit_local ( & place_ref. local , context, location) ;
167- }
168- }
169-
170- // `NonUseContext::VarDebugInfo` needs to flow all the
171- // way down to the base local (see `visit_local`).
172- if context == PlaceContext :: NonUse ( NonUseContext :: VarDebugInfo ) {
173- base_context = context;
174145 }
175146
176147 self . process_place ( & place_base, base_context, location) ;
@@ -185,20 +156,7 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
185156 ) ;
186157 }
187158 } else {
188- // FIXME this is super_place code, is repeated here to avoid cloning place or changing
189- // visit_place API
190- let mut context = context;
191-
192- if !place_ref. projection . is_empty ( ) {
193- context = if context. is_mutating_use ( ) {
194- PlaceContext :: MutatingUse ( MutatingUseContext :: Projection )
195- } else {
196- PlaceContext :: NonMutatingUse ( NonMutatingUseContext :: Projection )
197- } ;
198- }
199-
200159 self . visit_local ( & place_ref. local , context, location) ;
201- self . visit_projection ( * place_ref, context, location) ;
202160 }
203161 }
204162}
0 commit comments