about summary refs log tree commit diff
path: root/compiler/rustc_mir_dataflow
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-04-24 16:54:11 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-05-09 17:27:58 +0000
commit2b0bf3cf59dc54b9a5721e085405b7647fe82c14 (patch)
treedffa22393dbc8394474072dafbfddeece23b5fc0 /compiler/rustc_mir_dataflow
parent38fa676330eb938ca9e8f36397a9003509e8be07 (diff)
Trim the places that will not be used.
Diffstat (limited to 'compiler/rustc_mir_dataflow')
-rw-r--r--compiler/rustc_mir_dataflow/src/value_analysis.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler/rustc_mir_dataflow/src/value_analysis.rs b/compiler/rustc_mir_dataflow/src/value_analysis.rs
index 882f9dc11a1..ecdc6a6580e 100644
--- a/compiler/rustc_mir_dataflow/src/value_analysis.rs
+++ b/compiler/rustc_mir_dataflow/src/value_analysis.rs
@@ -675,6 +675,15 @@ impl Map {
                 self.cache_preorder_invoke(place);
             }
         }
+
+        // Trim useless places.
+        for opt_place in self.locals.iter_mut() {
+            if let Some(place) = *opt_place && self.inner_values[place].is_empty() {
+                *opt_place = None;
+            }
+        }
+        #[allow(rustc::potential_query_instability)]
+        self.projections.retain(|_, child| !self.inner_values[*child].is_empty());
     }
 
     /// Potentially register the (local, projection) place and its fields, recursively.
@@ -803,7 +812,7 @@ impl Map {
         tail_elem: Option<TrackElem>,
         f: &mut impl FnMut(ValueIndex),
     ) {
-        if place.is_indirect() {
+        if place.has_deref() {
             // We do not track indirect places.
             return;
         }