mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Merge pull request #576 from jbj/bbEntryReachesLocally-perf
C++: Fix performance of bbEntryReachesLocally (1.19)
This commit is contained in:
@@ -96,10 +96,18 @@ abstract class LocalScopeVariableReachability extends string {
|
||||
|
||||
private predicate bbEntryReachesLocally(BasicBlock bb, SemanticStackVariable v, ControlFlowNode node) {
|
||||
exists(int n |
|
||||
node = bb.getNode(n) and isSink(node, v) |
|
||||
not exists(int m | m < n | isBarrier(bb.getNode(m), v))
|
||||
node = bb.getNode(n) and
|
||||
isSink(node, v)
|
||||
|
|
||||
not exists(this.firstBarrierIndexIn(bb, v))
|
||||
or
|
||||
n <= this.firstBarrierIndexIn(bb, v)
|
||||
)
|
||||
}
|
||||
|
||||
private int firstBarrierIndexIn(BasicBlock bb, SemanticStackVariable v) {
|
||||
result = min(int m | isBarrier(bb.getNode(m), v))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user