mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
C++: data flow AlwaysTrueUponEntryLoop perf fix
The predicate `AlwaysTrueUponEntryLoop.getARelevantVariable` was very sensitive to join ordering, and with the 1.19 QL engine it got an unfortunate join order that made it explode on certain snapshots. With this change, it goes from taking minutes to taking less than a second on a libretro-uae snapshot.
This commit is contained in:
@@ -292,10 +292,7 @@ module FlowVar_internal {
|
||||
* Gets a variable that is assigned in this loop and read outside the loop.
|
||||
*/
|
||||
private Variable getARelevantVariable() {
|
||||
exists(BasicBlock bbAssign |
|
||||
assignmentLikeOperation(bbAssign.getANode(), result, _) and
|
||||
this.bbInLoop(bbAssign)
|
||||
) and
|
||||
result = this.getAVariableAssignedInLoop() and
|
||||
exists(VariableAccess va |
|
||||
va.getTarget() = result and
|
||||
readAccess(va) and
|
||||
@@ -303,6 +300,15 @@ module FlowVar_internal {
|
||||
)
|
||||
}
|
||||
|
||||
/** Gets a variable that is assigned in this loop. */
|
||||
pragma[noinline]
|
||||
private Variable getAVariableAssignedInLoop() {
|
||||
exists(BasicBlock bbAssign |
|
||||
assignmentLikeOperation(bbAssign.getANode(), result, _) and
|
||||
this.bbInLoop(bbAssign)
|
||||
)
|
||||
}
|
||||
|
||||
private predicate bbInLoopCondition(BasicBlock bb) {
|
||||
getCFNParent*(bb.getANode()) = this.(Loop).getCondition()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user