Anndrey24 commented on code in PR #17046:
URL: https://github.com/apache/tvm/pull/17046#discussion_r1622503667


##########
src/arith/rewrite_simplify.cc:
##########
@@ -1136,8 +1136,15 @@ PrimExpr RewriteSimplifier::Impl::VisitExpr_(const 
FloorDivNode* op) {
                        x + floordiv(y, z), CanProveGreaterEqual(z.Eval(), 0));
     TVM_TRY_REWRITE_IF(matches_one_of(floordiv(y + x * z, z), floordiv(y + z * 
x, z)),
                        floordiv(y, z) + x, CanProveGreaterEqual(z.Eval(), 0));
+    TVM_TRY_REWRITE_IF(floordiv(x * z * c1 + y, z * c1), x + floordiv(y, z * 
c1),
+                       CanProveGreaterEqual(z.Eval() * c1.Eval(), 0));

Review Comment:
   I went ahead and implemented the `CanProveGreater()` function and took the 
opportunity to change all other cases of possible division by zero that I could 
find in the `rewrite_simplify.cc` rules to use it too.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@tvm.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to