Use a closure instead of three chained iterators

This commit is contained in:
Oli Scherer
2025-04-29 14:23:23 +00:00
parent 820fce61e7
commit 9193dfe435
6 changed files with 58 additions and 72 deletions

View File

@@ -765,12 +765,12 @@ impl OpportunitySet {
// Replace `succ` by `new_succ` where it appears.
let mut num_edges = 0;
for s in basic_blocks[current].terminator_mut().successors_mut() {
basic_blocks[current].terminator_mut().successors_mut(|s| {
if *s == succ {
*s = new_succ;
num_edges += 1;
}
}
});
// Update predecessors with the new block.
let _new_succ = self.predecessors.push(num_edges);