From 202c34548515bbc542c28a1225882590cfa086eb Mon Sep 17 00:00:00 2001 From: joss-aztec <94053499+joss-aztec@users.noreply.github.com> Date: Mon, 5 Jun 2023 21:17:38 +0100 Subject: [PATCH] fix(ssa refactor): filter unreachable blocks from cfg (#1523) --- crates/noirc_evaluator/src/ssa_refactor/ir/cfg.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/cfg.rs b/crates/noirc_evaluator/src/ssa_refactor/ir/cfg.rs index 6b59f24417f..f08b477696a 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/ir/cfg.rs +++ b/crates/noirc_evaluator/src/ssa_refactor/ir/cfg.rs @@ -39,9 +39,10 @@ impl ControlFlowGraph { cfg } - /// Compute all of the edges between each block in the function + /// Compute all of the edges between each reachable block in the function fn compute(&mut self, func: &Function) { - for (basic_block_id, basic_block) in func.dfg.basic_blocks_iter() { + for basic_block_id in func.reachable_blocks() { + let basic_block = &func.dfg[basic_block_id]; self.compute_block(basic_block_id, basic_block); } }