-
Notifications
You must be signed in to change notification settings - Fork 89
Allow Simple dominators in Flow Analysis (instead of just variables) #2782
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
base: main
Are you sure you want to change the base?
Conversation
ce13ab3
to
76269bc
Compare
560947e
to
17d2c2f
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.
LGTM, only some wondering about the resimplification criteria
I'm wondering how safe this is w.r.t. mutable unboxing: if a mutable block ends up in a symbol, it must be marked as potentially escaping since the block could be modified by directly accessing its symbol. |
I think we're safe because of the following reasons:
Note that if/when we try to not move symbol definitions at top-level (and instead tweak the let-binding in place to indicate it's now a symbol), this reasoning will not hold anymore. |
This PR adds the ability for the data flow analysis to discover any Simple as a dominator, whereas previously only variables could be detected as dominators. In particular, that means that we can now detect (and add aliases) when a variable is aliased/dominated by a symbol or a constant.
Whenever we add such an alias to a constant, or a symbol (with a known type), we trigger a resimplification, since that opens up new opportunities for
Simplify
. This is in particular necessary for the example below to work.This (finally) solves #2123 , so that in the following example:
The
t.get
function is indeed inlined inside of the loop. Unfortunately, this required three rounds of simplification (the first one does the mutable unboxing, the second one adds the alias to the symbol for the lifted function, and finally the third one can do the inlining). In the future, we could do it with only two passes if we ran a second alias analysis after the mutable unboxing (but that will require quite a bit of work).It would be good if we could try and benchmark compilation times with this PR to checks whether the new code triggers too many resimplifications.