Python: Address review comments

This commit is contained in:
Rasmus Lerchedahl Petersen
2020-09-10 15:17:30 +02:00
parent 3a19b1e7fd
commit 92e7a5676d
2 changed files with 11 additions and 9 deletions

View File

@@ -147,11 +147,13 @@ module EssaFlow {
* excludes SSA flow through instance fields.
*/
predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) {
exists(Node preUpdate |
not preUpdate.(EssaNode).getVar() instanceof GlobalSsaVariable and
// If there is ESSA-flow out of a node `node`, we want flow
// both out of `node` and any post-update node of `node`.
exists(Node node |
not node.(EssaNode).getVar() instanceof GlobalSsaVariable and
not nodeTo.(EssaNode).getVar() instanceof GlobalSsaVariable and
EssaFlow::essaFlowStep(preUpdate, nodeTo) and
nodeFrom = update(preUpdate)
EssaFlow::essaFlowStep(node, nodeTo) and
nodeFrom = update(node)
)
}

View File

@@ -194,7 +194,7 @@ private module SsaComputeImpl {
defUseRank(v, b, rankix, i)
}
/** A `VarAccess` `use` of `v` in `b` at index `i`. */
/** A variable access `use` of `v` in `b` at index `i`. */
cached
predicate variableUse(SsaSourceVariable v, ControlFlowNode use, BasicBlock b, int i) {
(v.getAUse() = use or v.hasRefinement(use, _)) and
@@ -360,7 +360,7 @@ private module SsaComputeImpl {
i = rank[rankix](int j | variableDefine(v, _, b, j) or variableSourceUse(v, _, b, j))
}
/** A `VarAccess` `use` of `v` in `b` at index `i`. */
/** A variable access `use` of `v` in `b` at index `i`. */
cached
predicate variableSourceUse(SsaSourceVariable v, ControlFlowNode use, BasicBlock b, int i) {
v.getASourceUse() = use and
@@ -386,12 +386,12 @@ private module SsaComputeImpl {
}
/**
* Holds if `b2` is a transitive successor of `b1` and `v` occurs in `b1` [and
* in `b2` or one of its transitive successors]? but not in any block on the path
* Holds if `b2` is a transitive successor of `b1` and `v` occurs in `b1` and
* in `b2` or one of its transitive successors but not in any block on the path
* between `b1` and `b2`.
*/
private predicate varBlockReaches(SsaSourceVariable v, BasicBlock b1, BasicBlock b2) {
varOccursInBlock(v, b1) and
varOccursInBlock(v, b1) and
b2 = b1.getASuccessor() and
blockPrecedesVar(v, b2)
or