Auto merge of #140464 - oli-obk:successors-mut-perf, r=petrochenkov
Use a closure instead of three chained iterators Fixes the perf regression from #123948 That PR had chained a third option to the iterator which apparently didn't optimize well
This commit is contained in:
@@ -757,12 +757,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);
|
||||
|
||||
Reference in New Issue
Block a user