CSE: remember the abstract pointers in Load equations#518
Merged
xavierleroy merged 3 commits intomasterfrom Aug 19, 2024
Merged
CSE: remember the abstract pointers in Load equations#518xavierleroy merged 3 commits intomasterfrom
Load equations#518xavierleroy merged 3 commits intomasterfrom
Conversation
The two abstract pointers being compared can come from different block classifications, as long as the two classifications agree on globals and on the stack pointer.
Contributor
Author
|
The CI failure on PPC appears unrelated, it occurs also on master but not on my other CI, which uses different versions of qemu. To be debugged. |
xavierleroy
commented
Aug 19, 2024
Contributor
Author
xavierleroy
left a comment
There was a problem hiding this comment.
Testing at AbsInt shows good results. Merging.
| | nil => None | ||
| | Eq v str r' :: eqs1 => | ||
| if str && eq_rhs r r' then Some v else find_valnum_rhs r eqs1 | ||
| if str && compat_rhs r r' then Some v else find_valnum_rhs r eqs1 |
Contributor
Author
There was a problem hiding this comment.
We could probably take the glb (intersection) of the abstract pointers in r and r', as it seems that both abstract pointers are valid. But I'm not expecting any significant precision gain from that, so let's keep it for future work.
This is simpler than recomputing abstract pointers in the `kill_loads` functions. This is also more precise, as some results of value analysis may no longer be available at the PC where a `kill_loads` function is invoked.
Contributor
|
@xavierleroy FYI We are also experiencing problems with |
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.
CSE uses non-aliasing information provided by value analysis to reuse the result of a previous load after a store, provided the load and the store do not alias.
In the current implementation of CSE, the abstract pointer associated with the previous load is not stored in the CSE-inferred equations, but is recomputed at the point of the store just before calling the non-aliasing test
pdisjoint. This can lead to loss of precision, as in the following example:At the point of the store instruction, we no longer know that the value of x1 is a pointer into the "x" global. (That's because value analysis forgets the abstract values of pseudoregisters when they become dead, so as to avoid memory blowup on large codes.) Hence, CSE doesn't know that the "store" and the first "load" do not interfere, and forgets the equation describing the first "load". Consequently, the second "load" cannot be replaced by
z <- y.This PR addresses this issue by storing in
Loadequations the abstract pointers describing the location of the read. These abstract pointers are determined at the time whenLoadequations are generated and when full abstract value information is available. This produces better code for examples such as the one above, and could also reduce compilation times for CSE, as some recomputations of abstract pointers are avoided.