Skip to content

Commit 8280a60

Browse files
committed
Auto merge of rust-lang#134438 - lqd:const-qualif-bitsets, r=<try>
Try using compressible bitsets in const qualif These analyses domains should be very homogeneous, having compressed bitmaps on huge cfgs should make a difference (and hopefully have little impact on the smaller ones). r? ghost
2 parents 1d35638 + f2a1b09 commit 8280a60

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

compiler/rustc_const_eval/src/check_consts/resolver.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use std::fmt;
66
use std::marker::PhantomData;
77

8-
use rustc_index::bit_set::BitSet;
8+
use rustc_index::bit_set::MixedBitSet;
99
use rustc_middle::mir::visit::Visitor;
1010
use rustc_middle::mir::{
1111
self, BasicBlock, CallReturnPlaces, Local, Location, Statement, StatementKind, TerminatorEdges,
@@ -248,10 +248,10 @@ where
248248
#[derive(Debug, PartialEq, Eq)]
249249
pub(super) struct State {
250250
/// Describes whether a local contains qualif.
251-
pub qualif: BitSet<Local>,
251+
pub qualif: MixedBitSet<Local>,
252252
/// Describes whether a local's address escaped and it might become qualified as a result an
253253
/// indirect mutation.
254-
pub borrow: BitSet<Local>,
254+
pub borrow: MixedBitSet<Local>,
255255
}
256256

257257
impl Clone for State {
@@ -320,8 +320,8 @@ where
320320

321321
fn bottom_value(&self, body: &mir::Body<'tcx>) -> Self::Domain {
322322
State {
323-
qualif: BitSet::new_empty(body.local_decls.len()),
324-
borrow: BitSet::new_empty(body.local_decls.len()),
323+
qualif: MixedBitSet::new_empty(body.local_decls.len()),
324+
borrow: MixedBitSet::new_empty(body.local_decls.len()),
325325
}
326326
}
327327

compiler/rustc_index/src/bit_set.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,14 @@ impl<T: Idx> MixedBitSet<T> {
11911191
}
11921192
}
11931193

1194+
#[inline]
1195+
pub fn clear(&mut self) {
1196+
match self {
1197+
MixedBitSet::Small(set) => set.clear(),
1198+
MixedBitSet::Large(set) => set.clear(),
1199+
}
1200+
}
1201+
11941202
bit_relations_inherent_impls! {}
11951203
}
11961204

0 commit comments

Comments
 (0)