Commit 4a810866 by Sergei Grechanik Committed by Tianqi Chen

[ARITH] Bugfix: int bound analysis for mod (#3288)

parent bb48a45b
......@@ -190,7 +190,7 @@ class ConstIntBoundAnalyzer::Impl :
std::min(a.max_value, b_max_cap));
} else {
return MakeBound(std::max(a.min_value, -b_max_cap),
std::min(a.max_value, b_max_cap));
std::min(std::max(a.max_value, (int64_t)0), b_max_cap));
}
} else {
CHECK(!b.is_const(0)) << "mod by zero";
......
......@@ -564,6 +564,7 @@ def test_cmp_simplify():
ck.verify((x + 1)*(y - 1) < 0, tvm.const(1, "bool"))
ck.verify(y*y >= 0, tvm.const(1, "bool"))
ck.verify(x*6 <= -3, tvm.const(0, "bool"))
ck.verify((y - 1) % 3 == 0, (y + (-1)) % 3 == 0)
def test_logical_simplify():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment