Correct loop_headers logic.
This commit is contained in:
parent
54b61d6e1a
commit
8fb99afb02
@ -743,7 +743,7 @@ enum Update {
|
||||
/// Compute the set of loop headers in the given body. We define a loop header as a block which has
|
||||
/// at least a predecessor which it dominates. This definition is only correct for reducible CFGs.
|
||||
/// But if the CFG is already irreducible, there is no point in trying much harder.
|
||||
/// is already irreducibl
|
||||
/// is already irreducible.
|
||||
fn loop_headers(body: &Body<'_>) -> BitSet<BasicBlock> {
|
||||
let mut loop_headers = BitSet::new_empty(body.basic_blocks.len());
|
||||
let dominators = body.basic_blocks.dominators();
|
||||
@ -751,7 +751,7 @@ fn loop_headers(body: &Body<'_>) -> BitSet<BasicBlock> {
|
||||
for (bb, bbdata) in traversal::preorder(body) {
|
||||
for succ in bbdata.terminator().successors() {
|
||||
if dominators.dominates(succ, bb) {
|
||||
loop_headers.insert(bb);
|
||||
loop_headers.insert(succ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,8 +19,7 @@
|
||||
StorageLive(_1);
|
||||
_1 = DFA::A;
|
||||
StorageLive(_2);
|
||||
- goto -> bb1;
|
||||
+ goto -> bb7;
|
||||
goto -> bb1;
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -64,11 +63,6 @@
|
||||
_3 = const ();
|
||||
StorageDead(_7);
|
||||
goto -> bb1;
|
||||
+ }
|
||||
+
|
||||
+ bb7: {
|
||||
+ _4 = discriminant(_1);
|
||||
+ goto -> bb4;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,7 @@
|
||||
StorageLive(_1);
|
||||
_1 = DFA::A;
|
||||
StorageLive(_2);
|
||||
- goto -> bb1;
|
||||
+ goto -> bb7;
|
||||
goto -> bb1;
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -64,11 +63,6 @@
|
||||
_3 = const ();
|
||||
StorageDead(_7);
|
||||
goto -> bb1;
|
||||
+ }
|
||||
+
|
||||
+ bb7: {
|
||||
+ _4 = discriminant(_1);
|
||||
+ goto -> bb4;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user