Skip to content

Commit 11ceaf3

Browse files
committed
Fix bad join order in SsaDefinitionsImpl::reachesEndOfBlock.
1 parent 315dcb8 commit 11ceaf3

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

python/ql/src/semmle/dataflow/SsaCompute.qll

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,12 @@ private cached module SsaComputeImpl {
267267

268268
cached module SsaDefinitionsImpl {
269269

270+
pragma [noinline]
271+
private predicate reachesEndOfBlockRec(SsaSourceVariable v, BasicBlock defbb, int defindex, BasicBlock b) {
272+
exists(BasicBlock idom | reachesEndOfBlock(v, defbb, defindex, idom) |
273+
idom = b.getImmediateDominator()
274+
)
275+
}
270276
/**
271277
* The SSA definition of `v` at `def` reaches the end of a basic block `b`, at
272278
* which point it is still live, without crossing another SSA definition of `v`.
@@ -277,13 +283,10 @@ private cached module SsaComputeImpl {
277283
(
278284
defbb = b and SsaComputeImpl::ssaDefReachesRank(v, defbb, defindex, SsaComputeImpl::lastRank(v, b))
279285
or
280-
exists(BasicBlock idom |
281-
idom = b.getImmediateDominator() and
282-
// It is sufficient to traverse the dominator graph, cf. discussion above.
283-
reachesEndOfBlock(v, defbb, defindex, idom) and
284-
not SsaComputeImpl::ssaDef(v, b)
286+
// It is sufficient to traverse the dominator graph, cf. discussion above.
287+
reachesEndOfBlockRec(v, defbb, defindex, b) and
288+
not SsaComputeImpl::ssaDef(v, b)
285289
)
286-
)
287290
}
288291

289292
/**

0 commit comments

Comments
 (0)