Merge pull request #600 from markshannon/python-fix-performance-refinement-edge

Python ESSA: Fix performance of PythonSsaSourceVariable.hasRefinementEdge()
This commit is contained in:
Taus
2018-12-04 18:07:21 +01:00
committed by GitHub

View File

@@ -79,24 +79,12 @@ abstract class PythonSsaSourceVariable extends SsaSourceVariable {
}
override predicate hasRefinementEdge(ControlFlowNode use, BasicBlock pred, BasicBlock succ) {
test_contains(pred.getLastNode(), use) and
use.(NameNode).uses(this) and
exists(ControlFlowNode test |
test.getAChild*() = use and
test.isBranch() and
test = pred.getLastNode()
) and
(pred.getAFalseSuccessor() = succ or pred.getATrueSuccessor() = succ)
and
(pred.getAFalseSuccessor() = succ or pred.getATrueSuccessor() = succ) and
/* There is a store to this variable -- We don't want to refine builtins */
exists(this.(Variable).getAStore()) and
/* There is at least one use or definition of the variable that is reachable by the test */
exists(ControlFlowNode n |
n = this.getAUse() or
this.hasDefiningNode(n) |
pred.(ConditionBlock).strictlyReaches(n.getBasicBlock())
)
exists(this.(Variable).getAStore())
}
override ControlFlowNode getASourceUse() {
result.(NameNode).uses(this)
or