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:
@@ -106,7 +106,7 @@ impl<'short, 'long> InstBuilderBase<'short> for FuncInstBuilder<'short, 'long> {
|
||||
self.builder.func.set_srcloc(inst, self.builder.srcloc);
|
||||
}
|
||||
|
||||
match self.builder.func.dfg.insts[inst] {
|
||||
match &self.builder.func.dfg.insts[inst] {
|
||||
ir::InstructionData::Jump {
|
||||
destination: dest, ..
|
||||
} => {
|
||||
@@ -140,7 +140,7 @@ impl<'short, 'long> InstBuilderBase<'short> for FuncInstBuilder<'short, 'long> {
|
||||
.builder
|
||||
.func
|
||||
.jump_tables
|
||||
.get(table)
|
||||
.get(*table)
|
||||
.expect("you are referencing an undeclared jump table")
|
||||
.iter()
|
||||
.filter(|&dest_block| unique.insert(*dest_block))
|
||||
@@ -152,7 +152,7 @@ impl<'short, 'long> InstBuilderBase<'short> for FuncInstBuilder<'short, 'long> {
|
||||
.ssa
|
||||
.declare_block_predecessor(*dest_block, inst);
|
||||
}
|
||||
self.builder.declare_successor(destination, inst);
|
||||
self.builder.declare_successor(*destination, inst);
|
||||
}
|
||||
|
||||
_ => {}
|
||||
|
||||
@@ -577,7 +577,7 @@ impl SSABuilder {
|
||||
dest_block: Block,
|
||||
val: Value,
|
||||
) -> Option<(Block, Inst)> {
|
||||
match func.dfg.insts[branch] {
|
||||
match &func.dfg.insts[branch] {
|
||||
// For a single destination appending a jump argument to the instruction
|
||||
// is sufficient.
|
||||
InstructionData::Jump { .. } => {
|
||||
|
||||
Reference in New Issue
Block a user