Skip to content

Commit 44df16a

Browse files
committed
liveness: stop materializing facts that placeholders are live at all points
1 parent b4e6373 commit 44df16a

File tree

2 files changed

+3
-33
lines changed

2 files changed

+3
-33
lines changed

polonius-engine/src/output/liveness.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
//! An implementation of the origin liveness calculation logic
1212
13-
use std::collections::BTreeSet;
1413
use std::time::Instant;
1514

1615
use crate::facts::FactTypes;
@@ -23,7 +22,7 @@ pub(super) fn compute_live_origins<T: FactTypes>(
2322
cfg_edge: &Relation<(T::Point, T::Point)>,
2423
var_maybe_partly_initialized_on_exit: Relation<(T::Variable, T::Point)>,
2524
output: &mut Output<T>,
26-
) -> Vec<(T::Origin, T::Point)> {
25+
) -> Relation<(T::Origin, T::Point)> {
2726
let timer = Instant::now();
2827
let mut iteration = Iteration::new();
2928

@@ -151,20 +150,5 @@ pub(super) fn compute_live_origins<T: FactTypes>(
151150
}
152151
}
153152

154-
origin_live_on_entry.elements
155-
}
156-
157-
pub(super) fn make_universal_regions_live<T: FactTypes>(
158-
origin_live_on_entry: &mut Vec<(T::Origin, T::Point)>,
159-
cfg_node: &BTreeSet<T::Point>,
160-
universal_regions: &[T::Origin],
161-
) {
162-
debug!("make_universal_regions_live()");
163-
164-
origin_live_on_entry.reserve(universal_regions.len() * cfg_node.len());
165-
for &origin in universal_regions.iter() {
166-
for &point in cfg_node.iter() {
167-
origin_live_on_entry.push((origin, point));
168-
}
169-
}
153+
origin_live_on_entry
170154
}

polonius-engine/src/output/mod.rs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -191,25 +191,13 @@ impl<T: FactTypes> Output<T> {
191191
drop_of_var_derefs_origin: all_facts.drop_of_var_derefs_origin.clone(),
192192
};
193193

194-
let mut origin_live_on_entry = liveness::compute_live_origins(
194+
let origin_live_on_entry = liveness::compute_live_origins(
195195
liveness_ctx,
196196
&cfg_edge,
197197
var_maybe_partly_initialized_on_exit,
198198
&mut result,
199199
);
200200

201-
let cfg_node = cfg_edge
202-
.iter()
203-
.map(|&(point1, _)| point1)
204-
.chain(cfg_edge.iter().map(|&(_, point2)| point2))
205-
.collect();
206-
207-
liveness::make_universal_regions_live::<T>(
208-
&mut origin_live_on_entry,
209-
&cfg_node,
210-
&all_facts.universal_region,
211-
);
212-
213201
// 3) Borrow checking
214202

215203
// Prepare data as datafrog relations, ready to join.
@@ -222,8 +210,6 @@ impl<T: FactTypes> Output<T> {
222210
// analysis. If these facts happened to be recorded in separate MIR walks, we might also
223211
// avoid generating those facts.
224212

225-
let origin_live_on_entry = origin_live_on_entry.into();
226-
227213
// TODO: also flip the order of this relation's arguments in rustc
228214
// from `loan_invalidated_at(point, loan)` to `loan_invalidated_at(loan, point)`.
229215
// to avoid this allocation.

0 commit comments

Comments
 (0)