CSE: remember the abstract pointers in Load
equations
#518
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
Load
equations the abstract pointers describing the location of the read. These abstract pointers are determined at the time whenLoad
equations 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.