diff --git a/src/arithmetic/rewrite_simplify.cc b/src/arithmetic/rewrite_simplify.cc index 1ebb328925d0..6098faa44846 100644 --- a/src/arithmetic/rewrite_simplify.cc +++ b/src/arithmetic/rewrite_simplify.cc @@ -1169,7 +1169,7 @@ Mutate_(const Or* op, const Expr& self) { TVM_TRY_REWRITE(x != y || x == y, ctrue); TVM_TRY_REWRITE(x || !x, ctrue); TVM_TRY_REWRITE(x <= y || y < x, ctrue); - TVM_TRY_REWRITE(y < x || y <= x, ctrue); + TVM_TRY_REWRITE(y < x || x <= y, ctrue); TVM_TRY_REWRITE_IF(x < c1 || c2 < x, ctrue, c2.Eval()->value < c1.Eval()->value); diff --git a/tests/python/unittest/test_arith_rewrite_simplify.py b/tests/python/unittest/test_arith_rewrite_simplify.py index e752d7c632ab..be961a5c6543 100644 --- a/tests/python/unittest/test_arith_rewrite_simplify.py +++ b/tests/python/unittest/test_arith_rewrite_simplify.py @@ -508,10 +508,10 @@ def test_logical_simplify(): tvm.const(True, "bool")) ck.verify(tvm.expr.Or(tvm.expr.NE(x, y), tvm.expr.EQ(x, y)), tvm.const(True, "bool")) - ck.verify(tvm.expr.Or(x > y, tvm.expr.Not(x < y)), tvm.const(True, "bool")) + ck.verify(tvm.expr.Or(x > y, tvm.expr.Not(x > y)), tvm.const(True, "bool")) ck.verify(tvm.expr.Or(x <= y, y < x), tvm.const(True, "bool")) - ck.verify(tvm.expr.Or(y < x, y <= x), tvm.const(True, "bool")) + ck.verify(tvm.expr.Or(y < x, y >= x), tvm.const(True, "bool")) ck.verify(tvm.expr.Or(x < 1, 0 < x), tvm.const(True, "bool")) ck.verify(tvm.expr.Or(0 < x, x < 1), tvm.const(True, "bool"))