Skip to content

Commit 54b60b7

Browse files
committed
WIP move elimination
1 parent 991b35a commit 54b60b7

8 files changed

Lines changed: 1480 additions & 1 deletion

File tree

compiler/rustc_index/src/interval.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,26 @@ impl<I: Idx> IntervalSet<I> {
207207
needle <= *prev_end
208208
}
209209

210+
/// Returns whether any point in `range` is contained in the set.
211+
pub fn intersects_range(&self, range: impl RangeBounds<I> + Clone) -> bool {
212+
let start = inclusive_start(range.clone());
213+
let Some(end) = inclusive_end(self.domain, range) else {
214+
// empty range
215+
return false;
216+
};
217+
if start > end {
218+
return false;
219+
}
220+
221+
// Find the last interval whose start is <= end.
222+
let Some(last) = self.map.partition_point(|r| r.0 <= end).checked_sub(1) else {
223+
// All ranges in the map start after the new range's end
224+
return false;
225+
};
226+
let (_, prev_end) = &self.map[last];
227+
start <= *prev_end
228+
}
229+
210230
pub fn superset(&self, other: &IntervalSet<I>) -> bool
211231
where
212232
I: Step,

compiler/rustc_mir_dataflow/src/impls/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
mod borrowed_locals;
22
mod initialized;
33
mod liveness;
4+
mod precise_liveness;
45
mod storage_liveness;
56

67
pub use self::borrowed_locals::{MaybeBorrowedLocals, borrowed_locals};
@@ -12,6 +13,9 @@ pub use self::liveness::{
1213
DefUse, MaybeLiveLocals, MaybeTransitiveLiveLocals,
1314
TransferFunction as LivenessTransferFunction,
1415
};
16+
pub use self::precise_liveness::{
17+
SplitPointEffect, SplitPointIndex, dump_liveness_matrix, liveness_matrix,
18+
};
1519
pub use self::storage_liveness::{
1620
MaybeRequiresStorage, MaybeStorageDead, MaybeStorageLive, always_storage_live_locals,
1721
};

0 commit comments

Comments
 (0)