Skip to content

Commit

Permalink
chore: move constant creation out of loop (#6836)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Dec 17, 2024
1 parent f037c36 commit e341a3b
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@ impl Function {
}
}

let is_unconstrained = matches!(self.runtime(), RuntimeType::Brillig(_)).into();
let is_within_unconstrained = self.dfg.make_constant(is_unconstrained, NumericType::bool());
for instruction_id in is_unconstrained_calls {
let call_returns = self.dfg.instruction_results(instruction_id);
let original_return_id = call_returns[0];

// We replace the result with a fresh id. This will be unused, so the DIE pass will remove the leftover intrinsic call.
self.dfg.replace_result(instruction_id, original_return_id);

let is_unconstrained = matches!(self.runtime(), RuntimeType::Brillig(_)).into();
let is_within_unconstrained =
self.dfg.make_constant(is_unconstrained, NumericType::bool());
// Replace all uses of the original return value with the constant
self.dfg.set_value_from_id(original_return_id, is_within_unconstrained);
}
Expand Down

0 comments on commit e341a3b

Please sign in to comment.