Skip to content

Commit be7ba92

Browse files
committed
Swift: Cache 'lastRefRedef'.
1 parent 34de400 commit be7ba92

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

swift/ql/lib/codeql/swift/dataflow/Ssa.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ module Ssa {
3939
read2 = bb2.getNode(i2)
4040
)
4141
}
42+
43+
cached
44+
predicate lastRefRedef(BasicBlock bb, int i, Definition next) {
45+
SsaImplCommon::lastRefRedef(this, bb, i, next)
46+
}
4247
}
4348

4449
cached

swift/ql/lib/codeql/swift/dataflow/internal/DataFlowPrivate.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ private import codeql.swift.controlflow.ControlFlowGraph
55
private import codeql.swift.controlflow.CfgNodes
66
private import codeql.swift.dataflow.Ssa
77
private import codeql.swift.controlflow.BasicBlocks
8-
private import codeql.swift.dataflow.internal.SsaImplCommon as SsaImpl
98
private import codeql.swift.dataflow.FlowSummary as FlowSummary
109
private import codeql.swift.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
1110

@@ -51,7 +50,7 @@ private class SsaDefinitionNodeImpl extends SsaDefinitionNode, NodeImpl {
5150
}
5251

5352
private predicate localFlowSsaInput(Node nodeFrom, Ssa::Definition def, Ssa::Definition next) {
54-
exists(BasicBlock bb, int i | SsaImpl::lastRefRedef(def, bb, i, next) |
53+
exists(BasicBlock bb, int i | def.lastRefRedef(bb, i, next) |
5554
def.definesAt(_, bb, i) and
5655
def = nodeFrom.asDefinition()
5756
)

0 commit comments

Comments
 (0)