Skip to content

Commit

Permalink
fix: Fix no predicates for brillig with intermediate functions (noir-…
Browse files Browse the repository at this point in the history
…lang#5015)

# Description

## Problem\*

Fixes noir-lang#5012 using the entry point
instead of the source function, to consider intermediate functions.

## Summary\*



## Additional Context



## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
  • Loading branch information
sirasistant authored May 10, 2024
1 parent 7280bad commit 9c6de4b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/noirc_evaluator/src/ssa/opt/inlining.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,11 @@ impl<'function> PerFunctionContext<'function> {
let function = &ssa.functions[&func_id];
// If we have not already finished the flattening pass, functions marked
// to not have predicates should be marked as entry points unless we are inlining into brillig.
let entry_point = &ssa.functions[&self.context.entry_point];
let no_predicates_is_entry_point =
self.context.no_predicates_is_entry_point
&& function.is_no_predicates()
&& !matches!(self.source_function.runtime(), RuntimeType::Brillig);
&& !matches!(entry_point.runtime(), RuntimeType::Brillig);
if function.runtime().is_entry_point() || no_predicates_is_entry_point {
self.push_instruction(*id);
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
unconstrained fn main(x: u32, y: pub u32) {
intermediate_function(x, y);
}

fn intermediate_function(x: u32, y: u32) {
basic_checks(x, y);
}

Expand Down

0 comments on commit 9c6de4b

Please sign in to comment.