-
Notifications
You must be signed in to change notification settings - Fork 59
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
Use liveness info to speed up allocation #965
Conversation
compiler/src/liveness.ml
Outdated
let s_o' = if weak then Sv.add (L.unloc x) s_o else s_o in | ||
let s_i, c = live_c weak c s_o' in |
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.
This looks wrong. s_o'
should be s_o
and x
should be removed from s_i
.
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.
Indeed, this was certainly wrong. Is this better?
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.
libjade fails, so I guess it's wrong.
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.
This change might deserve an entry in the changelog.
I added an item. |
compiler/src/liveness.ml
Outdated
if Sv.subset s_i s_o then s_i, c | ||
else loop (Sv.union s_i s_o) in | ||
let s_i, c = loop s_o in | ||
s_i, (if weak then Sv.add (L.unloc x) s_o else s_o), Cfor (x, r, c) |
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.
Why do you look at weak
?
The variables occurring in the range are live before the for
instruction.
The tables used in allocation can be huge. We remove the dead variables from the tables, to reduce their sizes and speed up the pass.
b2a2625
to
f9714fb
Compare
Thanks! |
The tables used in allocation can be huge. We remove the dead variables from the tables, to reduce their sizes and speed up the pass. Inspired by CompCert that does something similar to reduce the cost of the value analysis.
Please review carefully the changes to Liveness, because I don't know what I did.
On this implementation of Keccak, the time taken by the analysis after inlining goes down from 20s to 1.5s. It still feels too much for 4 inlined functions (size 1700, 3800 variables). (More functions are inlined, but these are the ones where the time is spent).