Skip to content

Commit 4e7469e

Browse files
Replace multiple calls to predecessors_for
...with a single one to `predecessors`. `predecessors_for` requires taking the lock/incrementing the `RefCell` once each call.
1 parent 2ff1fc9 commit 4e7469e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/librustc_middle/mir/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -2716,14 +2716,16 @@ impl Location {
27162716
return true;
27172717
}
27182718

2719+
let predecessors = body.predecessors();
2720+
27192721
// If we're in another block, then we want to check that block is a predecessor of `other`.
2720-
let mut queue: Vec<BasicBlock> = body.predecessors_for(other.block).to_vec();
2722+
let mut queue: Vec<BasicBlock> = predecessors[other.block].to_vec();
27212723
let mut visited = FxHashSet::default();
27222724

27232725
while let Some(block) = queue.pop() {
27242726
// If we haven't visited this block before, then make sure we visit it's predecessors.
27252727
if visited.insert(block) {
2726-
queue.extend(body.predecessors_for(block).iter().cloned());
2728+
queue.extend(predecessors[block].iter().cloned());
27272729
} else {
27282730
continue;
27292731
}

0 commit comments

Comments
 (0)