From 3343cf80e9db7e7650f8bf0fdb3a1220fb1604b2 Mon Sep 17 00:00:00 2001 From: Trevor Elliott Date: Tue, 7 Feb 2023 14:51:18 -0800 Subject: [PATCH] Add assertions for matches that used to use analyze_branch (#5733) Following up from #5730, add debug assertions to ensure that new branch instructions don't slip through matches that used to use analyze_branch. --- cranelift/codegen/src/dominator_tree.rs | 2 +- cranelift/codegen/src/flowgraph.rs | 2 +- cranelift/codegen/src/inst_predicates.rs | 2 +- cranelift/codegen/src/ir/function.rs | 2 +- cranelift/codegen/src/verifier/mod.rs | 2 +- cranelift/frontend/src/frontend.rs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cranelift/codegen/src/dominator_tree.rs b/cranelift/codegen/src/dominator_tree.rs index 4f04b14ca1..b1b46afc8e 100644 --- a/cranelift/codegen/src/dominator_tree.rs +++ b/cranelift/codegen/src/dominator_tree.rs @@ -372,7 +372,7 @@ impl DominatorTree { } self.push_if_unseen(*dest); } - _ => {} + inst => debug_assert!(!inst.opcode().is_branch()), } } } diff --git a/cranelift/codegen/src/flowgraph.rs b/cranelift/codegen/src/flowgraph.rs index 5a5bd40aaf..e07ace218f 100644 --- a/cranelift/codegen/src/flowgraph.rs +++ b/cranelift/codegen/src/flowgraph.rs @@ -141,7 +141,7 @@ impl ControlFlowGraph { self.add_edge(block, inst, *dest); } } - _ => {} + inst => debug_assert!(!inst.opcode().is_branch()), } } } diff --git a/cranelift/codegen/src/inst_predicates.rs b/cranelift/codegen/src/inst_predicates.rs index 99ed3b6bdd..981d589ae9 100644 --- a/cranelift/codegen/src/inst_predicates.rs +++ b/cranelift/codegen/src/inst_predicates.rs @@ -204,7 +204,7 @@ pub(crate) fn visit_block_succs( } } - _ => {} + inst => debug_assert!(!inst.opcode().is_branch()), } } } diff --git a/cranelift/codegen/src/ir/function.rs b/cranelift/codegen/src/ir/function.rs index 4fbef01fc4..59fd18c070 100644 --- a/cranelift/codegen/src/ir/function.rs +++ b/cranelift/codegen/src/ir/function.rs @@ -315,7 +315,7 @@ impl FunctionStencil { } } - _ => {} + inst => debug_assert!(!inst.opcode().is_branch()), } } diff --git a/cranelift/codegen/src/verifier/mod.rs b/cranelift/codegen/src/verifier/mod.rs index d4c95ca376..8c3abcaa2c 100644 --- a/cranelift/codegen/src/verifier/mod.rs +++ b/cranelift/codegen/src/verifier/mod.rs @@ -1358,7 +1358,7 @@ impl<'a> Verifier<'a> { } } } - _ => {} + inst => debug_assert!(!inst.opcode().is_branch()), } match self.func.dfg.insts[inst].analyze_call(&self.func.dfg.value_lists) { diff --git a/cranelift/frontend/src/frontend.rs b/cranelift/frontend/src/frontend.rs index a260913af1..07e47a7b24 100644 --- a/cranelift/frontend/src/frontend.rs +++ b/cranelift/frontend/src/frontend.rs @@ -155,7 +155,7 @@ impl<'short, 'long> InstBuilderBase<'short> for FuncInstBuilder<'short, 'long> { self.builder.declare_successor(*destination, inst); } - _ => {} + inst => debug_assert!(!inst.opcode().is_branch()), } if data.opcode().is_terminator() {