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

loop_revisit method for dealing with recursive loops in the IR #3106

Merged
merged 1 commit into from
Mar 3, 2022

Conversation

ChrisDodd
Copy link
Contributor

  • by default will BUG("IR loop detected") (the old behavior), but allows
    writing visitor passes that can override and deal with it.

This is an experimental infrastructure extension that is most useful with the ResolutionContext/apply with context param stuff added awhile back -- using that code, a visitor can look up symbols and recursively visit the definition of the symbol, but doing so may lead to loops in the traversal. This change allows dealing with those resulting loops rather than just exiting with a BUG (though that is still the default behavior) by overriding the loop_revisit method in the Visitor subclass.

@mihaibudiu
Copy link
Contributor

Even DAGs cause difficulties today, allowing loops will make reasoning about the flow of control much harder.

- by default will BUG("IR loop detected") (the old behavior), but allows
  writing visitor passes that can override and deal with it.
@ChrisDodd ChrisDodd merged commit df473f7 into main Mar 3, 2022
@ChrisDodd ChrisDodd deleted the cdodd-testing branch March 3, 2022 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants