Refactor matches that used to consume BranchInfo (#5734)

Explicitly borrow the instruction data, and use a mutable borrow to avoid rematch.
This commit is contained in:
Trevor Elliott
2023-02-07 13:29:42 -08:00
committed by GitHub
parent fdd4a778fc
commit 2c8425998b
8 changed files with 24 additions and 50 deletions

View File

@@ -351,7 +351,7 @@ impl DominatorTree {
/// post-order except for the insertion of the new block header at the split point.
fn push_successors(&mut self, func: &Function, block: Block) {
if let Some(inst) = func.layout.last_inst(block) {
match func.dfg.insts[inst] {
match &func.dfg.insts[inst] {
ir::InstructionData::Jump {
destination: succ, ..
} => self.push_if_unseen(succ.block(&func.dfg.value_lists)),
@@ -367,10 +367,10 @@ impl DominatorTree {
destination: dest,
..
} => {
for succ in func.jump_tables[jt].iter() {
for succ in func.jump_tables[*jt].iter() {
self.push_if_unseen(*succ);
}
self.push_if_unseen(dest);
self.push_if_unseen(*dest);
}
_ => {}
}