diff --git a/compiler/noirc_evaluator/src/ssa/opt/loop_invariant.rs b/compiler/noirc_evaluator/src/ssa/opt/loop_invariant.rs index 87e7f8bcff3..9f07b076e8a 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/loop_invariant.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/loop_invariant.rs @@ -13,7 +13,7 @@ use fxhash::{FxHashMap as HashMap, FxHashSet as HashSet}; use crate::ssa::{ ir::{ basic_block::BasicBlockId, - function::{Function, RuntimeType}, + function::Function, function_inserter::FunctionInserter, instruction::{Instruction, InstructionId}, types::Type, @@ -27,12 +27,7 @@ use super::unrolling::{Loop, Loops}; impl Ssa { #[tracing::instrument(level = "trace", skip(self))] pub(crate) fn loop_invariant_code_motion(mut self) -> Ssa { - let brillig_functions = self - .functions - .iter_mut() - .filter(|(_, func)| matches!(func.runtime(), RuntimeType::Brillig(_))); - - for (_, function) in brillig_functions { + for function in self.functions.values_mut() { function.loop_invariant_code_motion(); } @@ -63,6 +58,7 @@ impl Loops { } context.map_dependent_instructions(); + context.inserter.map_data_bus_in_place(); } }