Skip to content

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

Merged
merged 3 commits into from
Jan 10, 2019
Merged

C++: QL CFG performance and tweaks #737

merged 3 commits into from
Jan 10, 2019

Conversation

jbj
Copy link
Contributor

@jbj jbj commented Jan 9, 2019

The main change here is the second commit, which cuts 30% off the run time of the most expensive predicate in the CFG calculation.

jbj added 3 commits January 9, 2019 14:58
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.
@jbj jbj added the C++ label Jan 9, 2019
@jbj jbj requested a review from a team as a code owner January 9, 2019 14:10
Copy link
Contributor

@geoffw0 geoffw0 left a 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting example.

Copy link
Contributor Author

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?

@geoffw0
Copy link
Contributor

geoffw0 commented Jan 10, 2019

Is the failing test relevant? Otherwise I'm happy to merge this.

@jbj
Copy link
Contributor Author

jbj commented Jan 10, 2019

The failing test is broken. Language-Tests/CPP passes, which is sufficient.

@geoffw0 geoffw0 merged commit 28261d6 into github:master Jan 10, 2019
cklin pushed a commit that referenced this pull request May 20, 2022
Post-release preparation for codeql-cli-2.9.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants