diff --git a/compiler/noirc_evaluator/src/ssa/opt/rc.rs b/compiler/noirc_evaluator/src/ssa/opt/rc.rs index 77d0a04e1dd..284ac0493c7 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/rc.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/rc.rs @@ -53,6 +53,11 @@ impl Function { /// This restriction lets this function largely ignore merging intermediate results from other /// blocks and handling loops. pub(crate) fn remove_paired_rc(&mut self) { + if !self.runtime().is_brillig() { + // dec_rc and inc_rc only have an effect in Brillig + return; + } + // `dec_rc` is only issued for parameters currently so we can speed things // up a bit by skipping any functions without them. if !contains_array_parameter(self) {