mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
Do not pre-compute reachable blocks.
This commit is contained in:
parent
f5e4eb91b7
commit
5b2524eb03
@ -74,12 +74,6 @@ impl<'tcx> MirPass<'tcx> for ElaborateDrops {
|
||||
.iterate_to_fixpoint()
|
||||
.into_results_cursor(body);
|
||||
let dead_unwinds = compute_dead_unwinds(&body, &mut inits);
|
||||
let mut reachable = BitSet::new_empty(body.basic_blocks.len());
|
||||
for bb in body.basic_blocks.indices() {
|
||||
if inits.results().entry_set_for_block(bb).is_reachable() {
|
||||
reachable.insert(bb);
|
||||
}
|
||||
}
|
||||
|
||||
let uninits = MaybeUninitializedPlaces::new(tcx, body, &env)
|
||||
.mark_inactive_variants_as_uninit()
|
||||
@ -97,7 +91,6 @@ impl<'tcx> MirPass<'tcx> for ElaborateDrops {
|
||||
init_data: InitializationData { inits, uninits },
|
||||
drop_flags,
|
||||
patch: MirPatch::new(body),
|
||||
reachable,
|
||||
}
|
||||
.elaborate()
|
||||
};
|
||||
@ -262,7 +255,6 @@ struct ElaborateDropsCtxt<'a, 'tcx> {
|
||||
init_data: InitializationData<'a, 'tcx>,
|
||||
drop_flags: IndexVec<MovePathIndex, Option<Local>>,
|
||||
patch: MirPatch<'tcx>,
|
||||
reachable: BitSet<BasicBlock>,
|
||||
}
|
||||
|
||||
impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
|
||||
@ -302,9 +294,6 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
|
||||
|
||||
fn collect_drop_flags(&mut self) {
|
||||
for (bb, data) in self.body.basic_blocks.iter_enumerated() {
|
||||
if !self.reachable.contains(bb) {
|
||||
continue;
|
||||
}
|
||||
let terminator = data.terminator();
|
||||
let place = match terminator.kind {
|
||||
TerminatorKind::Drop { ref place, .. } => place,
|
||||
@ -356,9 +345,6 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
|
||||
|
||||
fn elaborate_drops(&mut self) {
|
||||
for (bb, data) in self.body.basic_blocks.iter_enumerated() {
|
||||
if !self.reachable.contains(bb) {
|
||||
continue;
|
||||
}
|
||||
let loc = Location { block: bb, statement_index: data.statements.len() };
|
||||
let terminator = data.terminator();
|
||||
|
||||
@ -437,9 +423,6 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
|
||||
|
||||
fn drop_flags_for_fn_rets(&mut self) {
|
||||
for (bb, data) in self.body.basic_blocks.iter_enumerated() {
|
||||
if !self.reachable.contains(bb) {
|
||||
continue;
|
||||
}
|
||||
if let TerminatorKind::Call {
|
||||
destination,
|
||||
target: Some(tgt),
|
||||
@ -478,9 +461,6 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
|
||||
// clobbered before they are read.
|
||||
|
||||
for (bb, data) in self.body.basic_blocks.iter_enumerated() {
|
||||
if !self.reachable.contains(bb) {
|
||||
continue;
|
||||
}
|
||||
debug!("drop_flags_for_locs({:?})", data);
|
||||
for i in 0..(data.statements.len() + 1) {
|
||||
debug!("drop_flag_for_locs: stmt {}", i);
|
||||
|
@ -47,7 +47,8 @@
|
||||
|
||||
bb2 (cleanup): {
|
||||
_5 = move _6;
|
||||
drop(_6) -> [return: bb6, unwind terminate];
|
||||
- drop(_6) -> [return: bb6, unwind terminate];
|
||||
+ goto -> bb6;
|
||||
}
|
||||
|
||||
bb3: {
|
||||
@ -70,7 +71,8 @@
|
||||
}
|
||||
|
||||
bb6 (cleanup): {
|
||||
drop(_5) -> [return: bb7, unwind terminate];
|
||||
- drop(_5) -> [return: bb7, unwind terminate];
|
||||
+ goto -> bb7;
|
||||
}
|
||||
|
||||
bb7 (cleanup): {
|
||||
|
@ -47,7 +47,8 @@
|
||||
|
||||
bb3 (cleanup): {
|
||||
_2 = move _5;
|
||||
drop(_5) -> [return: bb8, unwind terminate];
|
||||
- drop(_5) -> [return: bb8, unwind terminate];
|
||||
+ goto -> bb8;
|
||||
}
|
||||
|
||||
bb4: {
|
||||
|
@ -47,7 +47,8 @@
|
||||
|
||||
bb3 (cleanup): {
|
||||
_2 = move _5;
|
||||
drop(_5) -> [return: bb8, unwind terminate];
|
||||
- drop(_5) -> [return: bb8, unwind terminate];
|
||||
+ goto -> bb8;
|
||||
}
|
||||
|
||||
bb4: {
|
||||
|
@ -54,8 +54,12 @@
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
+ _7 = const true;
|
||||
+ _8 = const true;
|
||||
+ _9 = const true;
|
||||
_1 = move _3;
|
||||
drop(_3) -> [return: bb11, unwind terminate];
|
||||
- drop(_3) -> [return: bb11, unwind terminate];
|
||||
+ goto -> bb11;
|
||||
}
|
||||
|
||||
bb5: {
|
||||
|
@ -54,8 +54,12 @@
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
+ _7 = const true;
|
||||
+ _8 = const true;
|
||||
+ _9 = const true;
|
||||
_1 = move _3;
|
||||
drop(_3) -> [return: bb11, unwind terminate];
|
||||
- drop(_3) -> [return: bb11, unwind terminate];
|
||||
+ goto -> bb11;
|
||||
}
|
||||
|
||||
bb5: {
|
||||
|
Loading…
Reference in New Issue
Block a user