Skip to content

Commit 3343cf8

Browse files
authored
Add assertions for matches that used to use analyze_branch (bytecodealliance#5733)
Following up from bytecodealliance#5730, add debug assertions to ensure that new branch instructions don't slip through matches that used to use analyze_branch.
1 parent 317cc51 commit 3343cf8

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

cranelift/codegen/src/dominator_tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ impl DominatorTree {
372372
}
373373
self.push_if_unseen(*dest);
374374
}
375-
_ => {}
375+
inst => debug_assert!(!inst.opcode().is_branch()),
376376
}
377377
}
378378
}

cranelift/codegen/src/flowgraph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl ControlFlowGraph {
141141
self.add_edge(block, inst, *dest);
142142
}
143143
}
144-
_ => {}
144+
inst => debug_assert!(!inst.opcode().is_branch()),
145145
}
146146
}
147147
}

cranelift/codegen/src/inst_predicates.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ pub(crate) fn visit_block_succs<F: FnMut(Inst, Block, bool)>(
204204
}
205205
}
206206

207-
_ => {}
207+
inst => debug_assert!(!inst.opcode().is_branch()),
208208
}
209209
}
210210
}

cranelift/codegen/src/ir/function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ impl FunctionStencil {
315315
}
316316
}
317317

318-
_ => {}
318+
inst => debug_assert!(!inst.opcode().is_branch()),
319319
}
320320
}
321321

cranelift/codegen/src/verifier/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,7 @@ impl<'a> Verifier<'a> {
13581358
}
13591359
}
13601360
}
1361-
_ => {}
1361+
inst => debug_assert!(!inst.opcode().is_branch()),
13621362
}
13631363

13641364
match self.func.dfg.insts[inst].analyze_call(&self.func.dfg.value_lists) {

cranelift/frontend/src/frontend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl<'short, 'long> InstBuilderBase<'short> for FuncInstBuilder<'short, 'long> {
155155
self.builder.declare_successor(*destination, inst);
156156
}
157157

158-
_ => {}
158+
inst => debug_assert!(!inst.opcode().is_branch()),
159159
}
160160

161161
if data.opcode().is_terminator() {

0 commit comments

Comments
 (0)