Skip to content

Commit 77ccff6

Browse files
committed
SSA: Replace exported def-reaches predicates (behaviour-preserving).
1 parent 6e272d0 commit 77ccff6

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

shared/ssa/codeql/ssa/Ssa.qll

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -796,28 +796,12 @@ module Make<LocationSig Location, InputSig<Location> Input> {
796796
liveThroughExt(bb, pragma[only_bind_into](v))
797797
}
798798

799-
pragma[nomagic]
800-
private predicate phiReadReachesEndOfBlock(BasicBlock pred, BasicBlock bb, SourceVariable v) {
801-
exists(PhiReadNode phi |
802-
ssaDefReachesEndOfBlockExt(bb, phi, v) and
803-
pred = getImmediateBasicBlockDominator(phi.getBasicBlock())
804-
)
805-
}
806-
807799
/**
808800
* NB: If this predicate is exposed, it should be cached.
809801
*
810802
* Same as `ssaDefReachesEndOfBlockExt`, but ignores phi-reads.
811803
*/
812-
pragma[nomagic]
813-
predicate ssaDefReachesEndOfBlock(BasicBlock bb, Definition def, SourceVariable v) {
814-
ssaDefReachesEndOfBlockExt(bb, def, v)
815-
or
816-
exists(BasicBlock mid |
817-
ssaDefReachesEndOfBlock(mid, def, v) and
818-
phiReadReachesEndOfBlock(mid, bb, v)
819-
)
820-
}
804+
predicate ssaDefReachesEndOfBlock = SsaDefReachesNew::ssaDefReachesEndOfBlock/3;
821805

822806
/**
823807
* NB: If this predicate is exposed, it should be cached.
@@ -870,14 +854,7 @@ module Make<LocationSig Location, InputSig<Location> Input> {
870854
*
871855
* Same as `ssaDefReachesReadExt`, but ignores phi-reads.
872856
*/
873-
pragma[nomagic]
874-
predicate ssaDefReachesRead(SourceVariable v, Definition def, BasicBlock bb, int i) {
875-
ssaDefReachesReadWithinBlock(v, def, bb, i)
876-
or
877-
ssaRef(bb, i, v, SsaActualRead()) and
878-
ssaDefReachesEndOfBlock(getABasicBlockPredecessor(bb), def, v) and
879-
not exists(Definition other | ssaDefReachesReadWithinBlock(v, other, bb, i))
880-
}
857+
predicate ssaDefReachesRead = SsaDefReachesNew::ssaDefReachesRead/4;
881858

882859
/**
883860
* NB: If this predicate is exposed, it should be cached.

0 commit comments

Comments
 (0)