@@ -7,9 +7,7 @@ use rustc_data_structures::graph::dominators::Dominators;
7
7
use rustc_index:: bit_set:: BitSet ;
8
8
use rustc_index:: vec:: { Idx , IndexVec } ;
9
9
use 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 } ;
13
11
use rustc_middle:: mir:: { self , Location , TerminatorKind } ;
14
12
use rustc_middle:: ty:: layout:: HasTyCtxt ;
15
13
use rustc_target:: abi:: LayoutOf ;
@@ -20,7 +18,9 @@ pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
20
18
let mir = fx. mir ;
21
19
let mut analyzer = LocalAnalyzer :: new ( fx) ;
22
20
23
- analyzer. visit_body ( & mir) ;
21
+ for ( bb, data) in mir. basic_blocks ( ) . iter_enumerated ( ) {
22
+ analyzer. visit_basic_block_data ( bb, data) ;
23
+ }
24
24
25
25
for ( local, decl) in mir. local_decls . iter_enumerated ( ) {
26
26
let ty = fx. monomorphize ( decl. ty ) ;
@@ -141,36 +141,7 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
141
141
142
142
if let mir:: ProjectionElem :: Deref = elem {
143
143
// Deref projections typically only read the pointer.
144
- // (the exception being `VarDebugInfo` contexts, handled below)
145
144
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;
174
145
}
175
146
176
147
self . process_place ( & place_base, base_context, location) ;
@@ -185,20 +156,7 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
185
156
) ;
186
157
}
187
158
} 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
-
200
159
self . visit_local ( & place_ref. local , context, location) ;
201
- self . visit_projection ( * place_ref, context, location) ;
202
160
}
203
161
}
204
162
}
0 commit comments