Skip to content

Commit 4ff39bc

Browse files
committed
Only traverse reachable blocks in JumpThreading.
1 parent 75e7cf5 commit 4ff39bc

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

compiler/rustc_mir_transform/src/jump_threading.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl<'tcx> crate::MirPass<'tcx> for JumpThreading {
8989
opportunities: Vec::new(),
9090
};
9191

92-
for bb in body.basic_blocks.indices() {
92+
for (bb, _) in traversal::preorder(body) {
9393
finder.start_from_switch(bb);
9494
}
9595

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
//@ known-bug: #131451
1+
//@ build-pass
22
//@ needs-rustc-debug-assertions
33
//@ compile-flags: -Zmir-enable-passes=+GVN -Zmir-enable-passes=+JumpThreading --crate-type=lib
44

55
pub fn fun(terminate: bool) {
66
while true {}
7+
//~^ WARN denote infinite loops with `loop { ... }`
78

89
while !terminate {}
910
}

0 commit comments

Comments
 (0)