-
Notifications
You must be signed in to change notification settings - Fork 228
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
CSE: remember the abstract pointers in Load
equations
#518
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.
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. |
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.
Testing at AbsInt shows good results. Merging.
@@ -77,7 +77,7 @@ Fixpoint find_valnum_rhs (r: rhs) (eqs: list equation) | |||
match eqs with | |||
| 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 |
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.
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.
@xavierleroy FYI We are also experiencing problems with |
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.