Skip to content

Commit

Permalink
chore(ssa): Activate loop invariant code motion on ACIR functions (#6785
Browse files Browse the repository at this point in the history
)
  • Loading branch information
vezenovm authored Dec 12, 2024
1 parent 655a3d3 commit bd46bdd
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions compiler/noirc_evaluator/src/ssa/opt/loop_invariant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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();
}

Expand Down Expand Up @@ -63,6 +58,7 @@ impl Loops {
}

context.map_dependent_instructions();
context.inserter.map_data_bus_in_place();
}
}

Expand Down

0 comments on commit bd46bdd

Please sign in to comment.