Skip to content

Commit fc020b8

Browse files
sgrechanik-htqchen
authored andcommitted
[ARITH] Fix the rule y < x && x <= y (#4220)
1 parent 2be444f commit fc020b8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/arithmetic/rewrite_simplify.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ Mutate_(const And* op, const Expr& self) {
16101610
TVM_TRY_REWRITE(x != y && x == y, cfalse);
16111611
TVM_TRY_REWRITE(x && !x, cfalse);
16121612
TVM_TRY_REWRITE(x <= y && y < x, cfalse);
1613-
TVM_TRY_REWRITE(y < x && y <= x, cfalse);
1613+
TVM_TRY_REWRITE(y < x && x <= y, cfalse);
16141614

16151615
TVM_TRY_REWRITE_IF(x < c1 && c2 < x, cfalse,
16161616
c2.Eval()->value + 1 >= c1.Eval()->value);

tests/python/unittest/test_arith_rewrite_simplify.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ def test_logical_simplify():
783783
tvm.const(False, "bool"))
784784
ck.verify(tvm.expr.And(x > 1, tvm.expr.Not(x > 1)), tvm.const(False, "bool"))
785785
ck.verify(tvm.expr.And(x <= y, y < x), tvm.const(False, "bool"))
786-
ck.verify(tvm.expr.And(y < x, y <= x), tvm.const(False, "bool"))
786+
ck.verify(tvm.expr.And(y < x, x <= y), tvm.const(False, "bool"))
787787
ck.verify(tvm.expr.And(x < 1, 0 < x), tvm.const(False, "bool"))
788788
ck.verify(tvm.expr.And(x < 0, 1 < x), tvm.const(False, "bool"))
789789
ck.verify(tvm.expr.And(x < 1, 1 <= x), tvm.const(False, "bool"))

0 commit comments

Comments
 (0)