-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C++: reuse unaliased SSA results when computing aliased SSA #5522
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
26ba625
to
75920ff
Compare
It's great to see this PR moving forward! Which CPP-Differences job is associated with this PR? https://jenkins.internal.semmle.com/job/Changes/job/CPP-Differences/1912/? There are test failures around autoformatting and synced files. Two tests failed:
|
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 is not a full review. Just a copy of my review comment from #5509.
cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/AliasConfiguration.qll
Outdated
Show resolved
Hide resolved
cpp/ql/test/library-tests/dataflow/DefaultTaintTracking/annotate_sinks_only/tainted.expected
Outdated
Show resolved
Hide resolved
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.
Only blocking issue is the commented-out code. Otherwise looks really good, with a couple minor comments.
cpp/ql/src/semmle/code/cpp/ir/implementation/internal/TOperand.qll
Outdated
Show resolved
Hide resolved
cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll
Outdated
Show resolved
Hide resolved
@@ -131,6 +132,8 @@ abstract class MemoryLocation extends TMemoryLocation { | |||
* with automatic storage duration). | |||
*/ | |||
predicate isAlwaysAllocatedOnStack() { none() } | |||
|
|||
final predicate canReuseSSA() { any() } |
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 would let a hypothetical fourth IR stage reuse anything from Aliased SSA IR, right? Maybe this should be none()
until we need it to be otherwise.
I've started a new changes job: internal link |
One more job: [internal link(]https://jenkins.internal.semmle.com/job/Changes/job/CPP-Differences/1995/) |
https://jenkins.internal.semmle.com/job/Changes/job/CPP-Differences/1995/ shows a speedup in My best guess is that you've made the IR faster but that some size estimates have changed and have triggered a bad join in some code that uses the IR. To make the next CPP-Differences fair, please merge from |
This refactors the SSA stages of the IR so that instructions which have a modeled memory result in the unaliased SSA stage do not have SSA recomputed in the aliased SSA stage.
247a7f4
to
db85a21
Compare
( | ||
f.parameterEscapesOnlyViaReturn(operand.(PositionalArgumentOperand).getIndex()) | ||
or | ||
f.parameterEscapesOnlyViaReturn(-1) and |
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.
Would it be more aesthetically pleasing to add a int getIndex() { none() }
predicate to ArgumentOperand
and implement it as result = -1
for ThisArgumentOperand
?
I'm happy to see there's progress on this PR. Are you ready to run CPP-Differences? |
Yes. New job is here: internal link |
Rerunning the job after some overnight issues with the CI system: internal link |
Looking at those numbers, there's a range from a slowdown of 1.5% to a speedup of 4.5%, with an average. Given that most of the ones that slowed down have bigger slowdowns in |
Code and CPP-differences LGTM! @dbartol I think your blocking issue has been fixed, right? |
The performance results look great!
I believe those "new" alerts are the ones that were fixed in #5859. If they're showing up here, it's an indication that the base commit in the comparison is too new. Unless the IR has become slower on |
This PR reuses the SSA construction from the unaliased SSA IR stage when building the aliased SSA IR stage, which results in a performance speedup of about 1% across the default query suite.