Skip to content
Closed
Show file tree
Hide file tree
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 @@ -186,6 +186,13 @@ impl BrilligGlobals {
&self,
brillig_function_id: FunctionId,
) -> Option<(&SsaToBrilligGlobals, &HoistedConstantsToBrilligGlobals)> {
// Check whether the user has declared any globals.
// If not we want to override the fetching of globals which relies on having performed
// entry point specialization. We skip entry point specialization if there are no globals.
if self.used_globals.values().all(|globals| globals.is_empty()) {
return None;
}

// Check whether `brillig_function_id` is itself an entry point.
// If so, return the global allocations directly.
let entry_point_globals = self.get_entry_point_globals(&brillig_function_id);
Expand Down
9 changes: 9 additions & 0 deletions compiler/noirc_evaluator/src/ssa/opt/brillig_entry_points.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ impl Ssa {
return self;
}

// Check whether any globals have been declared. If not, we do not need to run this pass.
if !self
.functions
.values()
.any(|function| function.dfg.globals.values_iter().next().is_some())
{
return self;
}

let brillig_entry_points = get_brillig_entry_points(&self.functions, self.main_id);

let functions_to_clone_map = build_functions_to_clone(&brillig_entry_points);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading