Skip to content

Commit 67685de

Browse files
committed
always get number of live variables from the map
1 parent 9910dee commit 67685de

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/librustc_mir/util/liveness.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,21 +168,21 @@ pub fn liveness_of_locals<'tcx, V: Idx>(
168168
mode: LivenessMode,
169169
map: &impl LiveVariableMap<LiveVar = V>,
170170
) -> LivenessResult<V> {
171-
let locals = map.num_variables();
171+
let num_live_vars = map.num_variables();
172172

173173
let def_use: IndexVec<_, DefsUses<V>> = mir
174174
.basic_blocks()
175175
.iter()
176-
.map(|b| block(mode, map, b, locals))
176+
.map(|b| block(mode, map, b, num_live_vars))
177177
.collect();
178178

179179
let mut outs: IndexVec<_, LocalSet<V>> = mir
180180
.basic_blocks()
181181
.indices()
182-
.map(|_| LocalSet::new_empty(locals))
182+
.map(|_| LocalSet::new_empty(num_live_vars))
183183
.collect();
184184

185-
let mut bits = LocalSet::new_empty(locals);
185+
let mut bits = LocalSet::new_empty(num_live_vars);
186186

187187
// queue of things that need to be re-processed, and a set containing
188188
// the things currently in the queue
@@ -239,13 +239,13 @@ impl<V: Idx> LivenessResult<V> {
239239
block,
240240
statement_index,
241241
};
242-
let locals = mir.local_decls.len();
242+
let num_live_vars = map.num_variables();
243243
let mut visitor = DefsUsesVisitor {
244244
mode: self.mode,
245245
map,
246246
defs_uses: DefsUses {
247-
defs: LocalSet::new_empty(locals),
248-
uses: LocalSet::new_empty(locals),
247+
defs: LocalSet::new_empty(num_live_vars),
248+
uses: LocalSet::new_empty(num_live_vars),
249249
},
250250
};
251251
// Visit the various parts of the basic block in reverse. If we go

0 commit comments

Comments
 (0)