Merge pull request #598 from jbj/AlwaysTrueUponEntryLoop-perf

C++: data flow AlwaysTrueUponEntryLoop perf fix
This commit is contained in:
Geoffrey White
2018-12-03 10:59:50 +00:00
committed by GitHub

View File

@@ -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()
}