Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move constant creation out of loop #6836

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading