Skip to content

Commit ce19972

Browse files
committed
SSA: Reinstate consistency check.
1 parent 6ac4cb7 commit ce19972

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

shared/ssa/codeql/ssa/Ssa.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,18 @@ module Make<LocationSig Location, InputSig<Location> Input> {
14081408
not uncertainWriteDefinitionInput(_, def)
14091409
}
14101410

1411+
/** Holds if a read is not dominated by a definition. */
1412+
query predicate notDominatedByDef(Definition def, SourceVariable v, BasicBlock bb, int i) {
1413+
exists(BasicBlock bbDef, int iDef | def.definesAt(v, bbDef, iDef) |
1414+
SsaDefReachesNew::ssaDefReachesReadWithinBlock(v, def, bb, i) and
1415+
(bb != bbDef or i < iDef)
1416+
or
1417+
ssaDefReachesRead(v, def, bb, i) and
1418+
not SsaDefReachesNew::ssaDefReachesReadWithinBlock(v, def, bb, i) and
1419+
not def.definesAt(v, getImmediateBasicBlockDominator*(bb), _)
1420+
)
1421+
}
1422+
14111423
/** Holds if the end of a basic block can be reached by multiple definitions. */
14121424
query predicate nonUniqueDefReachesEndOfBlock(Definition def, SourceVariable v, BasicBlock bb) {
14131425
ssaDefReachesEndOfBlock(bb, def, v) and

0 commit comments

Comments
 (0)