Skip to content

Commit b604ae1

Browse files
committed
ZJIT: Remove find() in clean_cfg
We don't need to materialize an instruction or even look at its operands.
1 parent a81c3eb commit b604ae1

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

zjit/src/hir.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5138,11 +5138,15 @@ impl Function {
51385138
let mut num_in_edges = vec![0; self.blocks.len()];
51395139
for block in self.rpo() {
51405140
for &insn in &self.blocks[block.0].insns {
5141-
match self.find(insn) {
5142-
Insn::IfTrue { target, .. } | Insn::IfFalse { target, .. } | Insn::Jump(target) => {
5143-
num_in_edges[target.target.0] += 1;
5141+
// Instructions without output, including branch instructions, can't be targets of
5142+
// make_equal_to, so we don't need find() here.
5143+
match &self.insns[insn.0] {
5144+
Insn::IfTrue { target: BranchEdge { target, .. }, .. }
5145+
| Insn::IfFalse { target: BranchEdge { target, .. }, .. }
5146+
| Insn::Jump(BranchEdge { target, .. }) => {
5147+
num_in_edges[target.0] += 1;
51445148
}
5145-
Insn::Entries { ref targets } => {
5149+
Insn::Entries { targets } => {
51465150
for target in targets {
51475151
num_in_edges[target.0] += 1;
51485152
}

0 commit comments

Comments
 (0)