mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge pull request #4319 from hvitved/python-java-block-precedes-var
Java/Python: Reduce size of `blockPrecedesVar`
This commit is contained in:
@@ -706,9 +706,9 @@ module Ssa {
|
||||
|
||||
/**
|
||||
* Holds if `def` is accessed in basic block `bb1` (either a read or a write),
|
||||
* `bb2` is a transitive successor of `bb1`, and `def` is *maybe* read in `bb2`
|
||||
* or one of its transitive successors, but not in any block on the path between
|
||||
* `bb1` and `bb2`.
|
||||
* `bb2` is a transitive successor of `bb1`, `def` is live at the end of `bb1`,
|
||||
* and the underlying variable for `def` is neither read nor written in any block
|
||||
* on the path between `bb1` and `bb2`.
|
||||
*/
|
||||
private predicate varBlockReaches(TrackedDefinition def, BasicBlock bb1, BasicBlock bb2) {
|
||||
varOccursInBlock(def, bb1, _) and
|
||||
|
||||
@@ -770,7 +770,9 @@ private module SsaImpl {
|
||||
|
||||
/** Holds if `v` occurs in `b` or one of `b`'s transitive successors. */
|
||||
private predicate blockPrecedesVar(TrackedVar v, BasicBlock b) {
|
||||
varOccursInBlock(v, b.getABBSuccessor*())
|
||||
varOccursInBlock(v, b)
|
||||
or
|
||||
ssaDefReachesEndOfBlock(v, _, b)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -321,7 +321,9 @@ private module SsaImpl {
|
||||
|
||||
/** Holds if `v` occurs in `b` or one of `b`'s transitive successors. */
|
||||
private predicate blockPrecedesVar(BaseSsaSourceVariable v, BasicBlock b) {
|
||||
varOccursInBlock(v, b.getABBSuccessor*())
|
||||
varOccursInBlock(v, b)
|
||||
or
|
||||
ssaDefReachesEndOfBlock(v, _, b)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -382,7 +382,9 @@ private module SsaComputeImpl {
|
||||
|
||||
/** Holds if `v` occurs in `b` or one of `b`'s transitive successors. */
|
||||
private predicate blockPrecedesVar(SsaSourceVariable v, BasicBlock b) {
|
||||
varOccursInBlock(v, b.getASuccessor*())
|
||||
varOccursInBlock(v, b)
|
||||
or
|
||||
SsaDefinitionsImpl::reachesEndOfBlock(v, _, _, b)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user