-
Notifications
You must be signed in to change notification settings - Fork 1.9k
C++: Performance fix for FlowVar.getAnAccess #403
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
The previous formulation of this predicate caused a CP in snapshots where a variable had a large number of definitions and also reached a large number of sub-basic-blocks. This should fix performance of https://github.com/FrodeSolheim/fs-uae and https://github.com/libretro/libretro-uae. The `FlowVar.getAnAccess` predicate is still at risk of CP'ing when a large group of defs has a large group of uses, but that has not been observed to happen in practice yet. We would need to make `localFlowStep` expose phi definitions in order to avoid that risk.
geoffw0
left a comment
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.
My runs of libretro-uae improve from 1049s to 745s with this change (compared to 1337s a few days ago). I'm happy and will merge this assuming the tests have passed.
If we're looking for further improvements there's still one expensive predicate left of the three I originally mentioned on Slack:
inconsistentLoopDirection.ql-11:FlowVar::FlowVar_internal::AlwaysTrueUponEntryLoop::getARelevantVariable_dispred#ff .. 6m30s
|
@geoffw0 I can't replicate that performance problem. On libretro-uae I get the following, using the latest |
|
That's great, we should keep an eye on the query to confirm though. |
|
For the On |
|
Good catch. I'll take a look. |
|
I should have investigated that problem better when you reported it the first time. The predicate had the shape |
|
With #598 it took just 370s and there are no standout predicates: |
As noted by @geoffw0 in #401, the previous formulation of this predicate caused a CP in snapshots where a variable had a large number of definitions and also reached a large number of sub-basic-blocks.
This should fix performance of https://github.com/FrodeSolheim/fs-uae and https://github.com/libretro/libretro-uae.
The
FlowVar.getAnAccesspredicate is still at risk of CP'ing when a large group of defs has a large group of uses, but that has not been observed to happen in practice yet. We would need to makelocalFlowStepexpose phi definitions in order to avoid that risk.