forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Various fixes and improvements to the MIR Dataflow framework #1
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
Open
gereeter
wants to merge
14
commits into
nagisa:mir-dflow
Choose a base branch
from
gereeter:mir-dflow
base: mir-dflow
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d4b132a
Remove use of specialization in Lattice to avoid use of unstable feat…
gereeter 8fb7a1c
Remove DataflowPass
gereeter 9a46cd7
Add &self arguments to Transfer and Rewrite and start taking them by …
gereeter ca08fdf
Remove unused and buggy support for dataflow passes that introduce mu…
gereeter c36dc32
Let ar_forward generate its own queue
gereeter ca52586
Change the fully capitalized ACS to the partially capitalized Acs, ma…
gereeter a1cf39a
Fix infinite loop in SimplifyCfg and re-enable it
gereeter e2d48c5
Fix various nits in MIR Dataflow
gereeter 50697a5
Actually rewrite constants in AcsPropagate
gereeter a40d9c1
Remove some unnecessary `pub`s in AcsPropagate
gereeter 52d150f
Invalidate values in AcsLattice that are overwritten, either by a wri…
gereeter 92628f7
Temporarily completely disable Backward dataflow to fix unused varian…
gereeter ab1d316
Rewrite AcsLattice to be more correct
gereeter d5c74f8
Further correctness improvements to AcsRewrite
gereeter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
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.
The bottom element in this lattice is an empty HashMap. It is fine to have it this way, because
HashMap::new()
does not allocate, to my knowledge.Similarly, I’m confused as to why the
Top
was removed fromEither
. I do not see how you could merge two different constants together and produce anything other than aTop
./me shrugs
Uh oh!
There was an error while loading. Please reload this page.
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.
I changed the lattice so that
HashMap::new()
is actually the top element of the lattice - I treat empty elements as top instead of bottom. You'll notice thatjoin
now does intersection instead of union. This is primarily because when we encounter an unknown function call, we need to mark everything asTop
, because the function call could change anything. This situation can be improved with alias analysis and information about what the function might do, but the default needs to beTop
. Similarly, when we enter the function, everything needs to beTop
. Consider the following case:Previously, since the value stored for
x
was bottom, we would merge the factbottom
and the factx = 5
at the end of the if statement, concluding thatx
was always5
. We would optimize to:which is just wrong.
Note that, in terms of inspiration, while the original paper used a union-based lattice for constant propogation, GHC actually uses an intersection based lattice (see here).
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.
Also, I realized after I wrote that code that
WBottom
existed and that it would have been better to use that. However, I'm still planning to remove the requirement that lattices havebottom
, again inspired by https://ghc.haskell.org/trac/ghc/wiki/Hoopl/Cleanup, and so I didn't bother to switch to a cleaner version.