diff --git a/shared/rangeanalysis/codeql/rangeanalysis/ModulusAnalysis.qll b/shared/rangeanalysis/codeql/rangeanalysis/ModulusAnalysis.qll index f9fbfa98614..1217439d3c0 100644 --- a/shared/rangeanalysis/codeql/rangeanalysis/ModulusAnalysis.qll +++ b/shared/rangeanalysis/codeql/rangeanalysis/ModulusAnalysis.qll @@ -17,14 +17,10 @@ module ModulusAnalysis< LocationSig Location, Semantic Sem, DeltaSig D, BoundSig Bounds, UtilSig U> { - pragma[nomagic] - private predicate valueFlowStepSsaEqFlowCond( - Sem::SsaReadPosition pos, Sem::SsaVariable v, Sem::Expr e, int delta - ) { - exists(Sem::Guard guard, boolean testIsTrue | - guard = U::semEqFlowCond(v, e, D::fromInt(delta), true, testIsTrue) and - Sem::guardDirectlyControlsSsaRead(guard, pos, testIsTrue) - ) + bindingset[pos, v] + pragma[inline_late] + private predicate hasReadOfVarInlineLate(Sem::SsaReadPosition pos, Sem::SsaVariable v) { + pos.hasReadOfVar(v) } /** @@ -36,8 +32,11 @@ module ModulusAnalysis< ) { U::semSsaUpdateStep(v, e, D::fromInt(delta)) and pos.hasReadOfVar(v) or - pos.hasReadOfVar(v) and - valueFlowStepSsaEqFlowCond(pos, v, e, delta) + exists(Sem::Guard guard, boolean testIsTrue | + hasReadOfVarInlineLate(pos, v) and + guard = U::semEqFlowCond(v, e, D::fromInt(delta), true, testIsTrue) and + Sem::guardDirectlyControlsSsaRead(guard, pos, testIsTrue) + ) } /**