-
Notifications
You must be signed in to change notification settings - Fork 829
[NFC] DeadArgumentElimination: Compute callers once #8053
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
Conversation
| // param, we see the call is not reached). This is somewhat rare, and the cost | ||
| // of computing this map is significant, so we compute it once at the start | ||
| // and then use that possibly-over-approximating data. | ||
| std::vector<std::unordered_set<Name>> callers; |
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.
Maybe we can make these even faster by making the inner set into another vector.
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.
Good idea, done. I can't seem to measure a speedup from it, but maybe it depends on CPU or workload, and the vectors should be better.
Co-authored-by: Thomas Lively <tlively123@gmail.com>
Co-authored-by: Thomas Lively <tlively123@gmail.com>
This is an over-approximation, as later iterations may have fewer calls - if we
remove a call. Such removal is rare, however, and the cost of computing this
map is actually very high. Computing it once up front, and using that over-
approximation, turns out to be much faster, even if in theory it can lead to a
little wasted work (more scanning; but no optimizations are missed, as we do
not use this mapping to decide what/how to optimize).
This makes the pass 30-40% faster on several large testcases I tried, from
Dart, Java, and C++. I did see two testcases that benefited only by 10-20%,
from GraalVM and Rust, but I saw none that did not benefit significantly.
This was the slowest pass in some of those 30-40% cases.
Helps #4165