Skip to content

Commit 2b0bf3c

Browse files
committed
Trim the places that will not be used.
1 parent 38fa676 commit 2b0bf3c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

compiler/rustc_mir_dataflow/src/value_analysis.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,15 @@ impl Map {
675675
self.cache_preorder_invoke(place);
676676
}
677677
}
678+
679+
// Trim useless places.
680+
for opt_place in self.locals.iter_mut() {
681+
if let Some(place) = *opt_place && self.inner_values[place].is_empty() {
682+
*opt_place = None;
683+
}
684+
}
685+
#[allow(rustc::potential_query_instability)]
686+
self.projections.retain(|_, child| !self.inner_values[*child].is_empty());
678687
}
679688

680689
/// Potentially register the (local, projection) place and its fields, recursively.
@@ -803,7 +812,7 @@ impl Map {
803812
tail_elem: Option<TrackElem>,
804813
f: &mut impl FnMut(ValueIndex),
805814
) {
806-
if place.is_indirect() {
815+
if place.has_deref() {
807816
// We do not track indirect places.
808817
return;
809818
}

0 commit comments

Comments
 (0)