about summary refs log tree commit diff
path: root/compiler/rustc_mir_dataflow/src
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_mir_dataflow/src')
-rw-r--r--compiler/rustc_mir_dataflow/src/debuginfo.rs10
-rw-r--r--compiler/rustc_mir_dataflow/src/impls/liveness.rs3
2 files changed, 5 insertions, 8 deletions
diff --git a/compiler/rustc_mir_dataflow/src/debuginfo.rs b/compiler/rustc_mir_dataflow/src/debuginfo.rs
index 274c5943946..0d25ce91c9a 100644
--- a/compiler/rustc_mir_dataflow/src/debuginfo.rs
+++ b/compiler/rustc_mir_dataflow/src/debuginfo.rs
@@ -5,16 +5,16 @@ use rustc_middle::mir::*;
 /// Return the set of locals that appear in debuginfo.
 pub fn debuginfo_locals(body: &Body<'_>) -> DenseBitSet<Local> {
     let mut visitor = DebuginfoLocals(DenseBitSet::new_empty(body.local_decls.len()));
-    visitor.visit_body(body);
+    for debuginfo in body.var_debug_info.iter() {
+        visitor.visit_var_debug_info(debuginfo);
+    }
     visitor.0
 }
 
 struct DebuginfoLocals(DenseBitSet<Local>);
 
 impl Visitor<'_> for DebuginfoLocals {
-    fn visit_local(&mut self, local: Local, place_context: PlaceContext, _: Location) {
-        if place_context == PlaceContext::NonUse(NonUseContext::VarDebugInfo) {
-            self.0.insert(local);
-        }
+    fn visit_local(&mut self, local: Local, _: PlaceContext, _: Location) {
+        self.0.insert(local);
     }
 }
diff --git a/compiler/rustc_mir_dataflow/src/impls/liveness.rs b/compiler/rustc_mir_dataflow/src/impls/liveness.rs
index 037e2720f36..f6aaa65ad9f 100644
--- a/compiler/rustc_mir_dataflow/src/impls/liveness.rs
+++ b/compiler/rustc_mir_dataflow/src/impls/liveness.rs
@@ -287,9 +287,6 @@ impl<'a, 'tcx> Analysis<'tcx> for MaybeTransitiveLiveLocals<'a> {
         if let Some(destination) =
             Self::can_be_removed_if_dead(&statement.kind, &self.always_live, &self.debuginfo_locals)
             && !state.contains(destination.local)
-            // FIXME: We can eliminate the statement, but we'll need the statements it depends on
-            // for debuginfos. We need a way to handle this.
-            && !self.debuginfo_locals.contains(destination.local)
         {
             // This store is dead
             return;