Skip to content

Commit ac115e0

Browse files
committed
Rangeanalysis: Reshuffle perf fix. This should result in the same join-order, but with less materialisation.
1 parent bb2bbd2 commit ac115e0

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

shared/rangeanalysis/codeql/rangeanalysis/ModulusAnalysis.qll

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,10 @@ module ModulusAnalysis<
1717
LocationSig Location, Semantic Sem, DeltaSig D, BoundSig<Location, Sem, D> Bounds,
1818
UtilSig<Sem, D> U>
1919
{
20-
pragma[nomagic]
21-
private predicate valueFlowStepSsaEqFlowCond(
22-
Sem::SsaReadPosition pos, Sem::SsaVariable v, Sem::Expr e, int delta
23-
) {
24-
exists(Sem::Guard guard, boolean testIsTrue |
25-
guard = U::semEqFlowCond(v, e, D::fromInt(delta), true, testIsTrue) and
26-
Sem::guardDirectlyControlsSsaRead(guard, pos, testIsTrue)
27-
)
20+
bindingset[pos, v]
21+
pragma[inline_late]
22+
private predicate hasReadOfVarInlineLate(Sem::SsaReadPosition pos, Sem::SsaVariable v) {
23+
pos.hasReadOfVar(v)
2824
}
2925

3026
/**
@@ -36,8 +32,11 @@ module ModulusAnalysis<
3632
) {
3733
U::semSsaUpdateStep(v, e, D::fromInt(delta)) and pos.hasReadOfVar(v)
3834
or
39-
pos.hasReadOfVar(v) and
40-
valueFlowStepSsaEqFlowCond(pos, v, e, delta)
35+
exists(Sem::Guard guard, boolean testIsTrue |
36+
hasReadOfVarInlineLate(pos, v) and
37+
guard = U::semEqFlowCond(v, e, D::fromInt(delta), true, testIsTrue) and
38+
Sem::guardDirectlyControlsSsaRead(guard, pos, testIsTrue)
39+
)
4140
}
4241

4342
/**

0 commit comments

Comments
 (0)