RangeAnalysis: Improve bounds that rely on relative modulus.

This commit is contained in:
Anders Schack-Mulligen
2023-11-02 11:36:46 +01:00
parent 484d0fe4cd
commit 7bf271fb6c
2 changed files with 11 additions and 6 deletions

View File

@@ -264,6 +264,13 @@ module ModulusAnalysis<
val = remainder(val0 + delta, mod)
)
or
exists(Sem::Expr mid, int v, int m1, int m2 |
exprModulus(mid, b, v, m1) and
e = modExpr(mid, m2) and
mod = m1.gcd(m2) and
val = remainder(v, mod)
)
or
exists(Sem::ConditionalExpr cond, int v1, int v2, int m1, int m2 |
cond = e and
condExprBranchModulus(cond, true, b, v1, m1) and