Replace multiple calls to predecessors_for
...with a single one to `predecessors`. `predecessors_for` requires taking the lock/incrementing the `RefCell` once each call.
This commit is contained in:
parent
2ff1fc9b81
commit
4e7469eaea
1 changed files with 4 additions and 2 deletions
|
|
@ -2716,14 +2716,16 @@ impl Location {
|
|||
return true;
|
||||
}
|
||||
|
||||
let predecessors = body.predecessors();
|
||||
|
||||
// If we're in another block, then we want to check that block is a predecessor of `other`.
|
||||
let mut queue: Vec<BasicBlock> = body.predecessors_for(other.block).to_vec();
|
||||
let mut queue: Vec<BasicBlock> = predecessors[other.block].to_vec();
|
||||
let mut visited = FxHashSet::default();
|
||||
|
||||
while let Some(block) = queue.pop() {
|
||||
// If we haven't visited this block before, then make sure we visit it's predecessors.
|
||||
if visited.insert(block) {
|
||||
queue.extend(body.predecessors_for(block).iter().cloned());
|
||||
queue.extend(predecessors[block].iter().cloned());
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue