-
Notifications
You must be signed in to change notification settings - Fork 1.7k
C++: QL CFG performance and tweaks #737
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
This improves performance slightly by putting the parameters in the order in which they'll be needed in `qlCFGSuccessor`.
This recursive predicate is made faster by working around a known optimizer problem (QL-796) that causes the optimizer to insert extra type checks in recursive case even when they are only needed in the base case.
The QL CFG and extractor CFG are the same, so the test passes. Neither of them model that `ref` may or may not be destructed.
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.
Changes LGTM.
// If `x` was true, `ref` refers to a temporary object whose lifetime was | ||
// extended to coincide with `ref`. Before the function returns, it | ||
// should destruct `ref` if and only if the first branch was taken in the | ||
// ?: expression. |
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.
Interesting example.
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.
Yes, isn't it. @dave-bartolomeo told me yesterday that there were cases with ? :
where the compiler would have to create a temporary variable to store which case was taken in order to know whether it should call a destructor. I fiddled around in Compiler Explorer until I got some code with branching around the destructor call. Is that example something like what you had in mind, @dave-bartolomeo?
Is the failing test relevant? Otherwise I'm happy to merge this. |
The failing test is broken. Language-Tests/CPP passes, which is sufficient. |
Post-release preparation for codeql-cli-2.9.2
The main change here is the second commit, which cuts 30% off the run time of the most expensive predicate in the CFG calculation.