fix(ssa): Mark mutually recursive simple functions#8447
Merged
Conversation
… in inline_functions_with_at_most_one_instruction, new call_graph module
Contributor
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Test Suite Duration'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 77e5165 | Previous: f8c6943 | Ratio |
|---|---|---|---|
test_report_noir-lang_noir_bigcurve_ |
302 s |
229 s |
1.32 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
aakoshh
reviewed
May 12, 2025
aakoshh
reviewed
May 12, 2025
aakoshh
approved these changes
May 12, 2025
Contributor
aakoshh
left a comment
There was a problem hiding this comment.
It's great to see general graph algorithms coming into action 👍
…e-funcs' into mv/mark-mutually-recursive-simple-funcs
github-merge-queue bot
pushed a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
May 13, 2025
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE fix: sign extend in signed cast (noir-lang/noir#8264) chore(fuzz): Do not use zero length types in the main input output (noir-lang/noir#8465) chore: fix visibility issues in test suite (noir-lang/noir#8454) chore: blackbox functions for ssa intepreter (noir-lang/noir#8375) feat: improve bitshift codegen (noir-lang/noir#8442) fix(ssa): Mark mutually recursive simple functions (noir-lang/noir#8447) fix: Fix nested trait dispatch with associated types (noir-lang/noir#8440) chore: carry visibilities in monomorphized AST (noir-lang/noir#8439) chore(tests): Add regression for now passing test (noir-lang/noir#8441) chore: use human-readable bytecode in snapshots (noir-lang/noir#8164) chore: bump external pinned commits (noir-lang/noir#8445) END_COMMIT_OVERRIDE --------- Co-authored-by: AztecBot <tech@aztecprotocol.com> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem*
Resolves #8414
We were not correctly checking for mutually recursive functions in
inline_functions_with_at_most_one_instruction.Summary*
I chose to lean into computing a full graph here as to push for re-use of the same call graph. As noted by #7228 we have multiple implementations of call graphs. Even though
inline_functions_with_at_most_one_instructionshould ideally only process functions with a single instruction, I felt leaning into a single call graph was better and simpler than expanding theinline_functions_with_at_most_one_instructionrecursion check to account for mutual recursion cycles.I went with using the call graph from
opt::pure. I went with this graph as it uses petgraph. Using this crate simplifies our graph generation and provides nice utility methods out of the box such as fetching strongly connected components (SCC).After generating the
CallGraphwe determine the recursive functions by checking the graph's SCCs.Additional Context
I experimented with using the
InlineInfocomputation. This revealed that the call graph there is not appropriately marking recursive functions. I have captured an issue here #8448 and I have added a test with#[should_panic]. I will resolve this issue in a follow-up where theInlineInfocomputation uses the same call graph as we use in this PR.Documentation*
Check one:
PR Checklist*
cargo fmton default settings.