Skip to content

C++: Fix performance of IR AliasAnalysis #38

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
Aug 10, 2018

Conversation

jbj
Copy link
Contributor

@jbj jbj commented Aug 9, 2018

I thought the bad performance of AliasAnalysis was due to recursion through double negation, but it turns out that the QL compiler optimized that perfectly well. Instead it was due to a bad join order in Instruction.hasUse, which was caused by a check that I don't think is necessary. Do you agree, @dave-bartolomeo?

The first commit fixes performance, and the second commit is cleanup.

jbj added 2 commits August 9, 2018 15:36
The check that an instruction is in the same function as its operands is
hopefully redundant and can be removed. Just to be sure, I've added the
check to a sanity query.

This check turned out to cause bad performance in the alias analysis
because it got inlined into `AliasAnalysis::resultEscapes` and then
pulled out to a loop-invariant predicate that got a bad join order. With
this check removed, the `ssa/AliasAnalysis.qll` file is orders of
magnitude faster.
Now that it's been simplified to be the same as `getOperand`, it doesn't
seem to have a purpose.
Copy link
Contributor

@dave-bartolomeo dave-bartolomeo left a comment

Choose a reason for hiding this comment

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

You're right, that check looks redundant. I'm glad speeding up alias analysis was this straightforward.

@semmle-qlci semmle-qlci merged commit bbee9a8 into github:master Aug 10, 2018
smowton pushed a commit to smowton/codeql that referenced this pull request Oct 28, 2021
Kotlin: Handle zero-width locations for generated elements
erik-krogh added a commit to erik-krogh/ql that referenced this pull request Dec 15, 2021
add a query for finding rank[1]
erik-krogh added a commit to erik-krogh/ql that referenced this pull request Dec 15, 2021
add a query for finding rank[1]
smowton pushed a commit to smowton/codeql that referenced this pull request Feb 7, 2022
These are now in Kotlin github#38
igfoo added a commit that referenced this pull request May 11, 2022
These are now in Kotlin #38
dbartol pushed a commit that referenced this pull request Dec 18, 2024
Ensure event sources are available for triggering events
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.

3 participants