-
Notifications
You must be signed in to change notification settings - Fork 659
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
Improve handling of guards while flattening. #28392
Conversation
Couple things to note: This doesn't currently use the cached conditional idea for guarding against early returns for asserts... so in principle a lot of unnecessary code could be generated if there are multiple asserts following a bunch of early returns. Also, the ntzseals.leo test now passes because it doesn't generate too much code. |
e52ea05
to
9b7aab2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nits, but looks good overall!
Specifically three changes are made: 1. Cache Anded together chains of conditionals for early returns. This prevents quadratic code being generated in the face of a chain of ifs like ``` if a { return 0u32; } else if b { return 1u32 } else if ... ``` 2. Take into account early returns for asserts, and cache the when reconstructing the assert, as with caching them for early returns. Fixes #28386, #28387
Alright; I've made a few changes and I think I've addressed everything including the SSA issue. Note that I rebased and changed the commit message a bit too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Great work on this PR @mikebenfield!
Specifically two changes are made:
Fixes #28386, #28387