From 136090813af590970a9091f03c088f81f7223851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Tue, 22 Dec 2020 23:57:50 +0100 Subject: [PATCH] liveness: stop materializing facts that placeholders are live at all points --- polonius-engine/src/output/liveness.rs | 20 ++------------------ polonius-engine/src/output/mod.rs | 16 +--------------- 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/polonius-engine/src/output/liveness.rs b/polonius-engine/src/output/liveness.rs index f24f6552976..c3c5183076b 100644 --- a/polonius-engine/src/output/liveness.rs +++ b/polonius-engine/src/output/liveness.rs @@ -10,7 +10,6 @@ //! An implementation of the origin liveness calculation logic -use std::collections::BTreeSet; use std::time::Instant; use crate::facts::FactTypes; @@ -23,7 +22,7 @@ pub(super) fn compute_live_origins( cfg_edge: &Relation<(T::Point, T::Point)>, var_maybe_partly_initialized_on_exit: Relation<(T::Variable, T::Point)>, output: &mut Output, -) -> Vec<(T::Origin, T::Point)> { +) -> Relation<(T::Origin, T::Point)> { let timer = Instant::now(); let mut iteration = Iteration::new(); @@ -151,20 +150,5 @@ pub(super) fn compute_live_origins( } } - origin_live_on_entry.elements -} - -pub(super) fn make_universal_regions_live( - origin_live_on_entry: &mut Vec<(T::Origin, T::Point)>, - cfg_node: &BTreeSet, - universal_regions: &[T::Origin], -) { - debug!("make_universal_regions_live()"); - - origin_live_on_entry.reserve(universal_regions.len() * cfg_node.len()); - for &origin in universal_regions.iter() { - for &point in cfg_node.iter() { - origin_live_on_entry.push((origin, point)); - } - } + origin_live_on_entry } diff --git a/polonius-engine/src/output/mod.rs b/polonius-engine/src/output/mod.rs index 21b173fc390..3e7b8ad4602 100644 --- a/polonius-engine/src/output/mod.rs +++ b/polonius-engine/src/output/mod.rs @@ -191,25 +191,13 @@ impl Output { drop_of_var_derefs_origin: all_facts.drop_of_var_derefs_origin.clone(), }; - let mut origin_live_on_entry = liveness::compute_live_origins( + let origin_live_on_entry = liveness::compute_live_origins( liveness_ctx, &cfg_edge, var_maybe_partly_initialized_on_exit, &mut result, ); - let cfg_node = cfg_edge - .iter() - .map(|&(point1, _)| point1) - .chain(cfg_edge.iter().map(|&(_, point2)| point2)) - .collect(); - - liveness::make_universal_regions_live::( - &mut origin_live_on_entry, - &cfg_node, - &all_facts.universal_region, - ); - // 3) Borrow checking // Prepare data as datafrog relations, ready to join. @@ -222,8 +210,6 @@ impl Output { // analysis. If these facts happened to be recorded in separate MIR walks, we might also // avoid generating those facts. - let origin_live_on_entry = origin_live_on_entry.into(); - // TODO: also flip the order of this relation's arguments in rustc // from `loan_invalidated_at(point, loan)` to `loan_invalidated_at(loan, point)`. // to avoid this allocation.