jcf94 commented on a change in pull request #5898: URL: https://github.com/apache/incubator-tvm/pull/5898#discussion_r444299222
########## File path: src/arith/rewrite_simplify.cc ########## @@ -865,6 +900,28 @@ PrimExpr RewriteSimplifier::Impl::VisitExpr_(const FloorModNode* op) { TVM_TRY_REWRITE_IF(floormod(x + y * c1, c2), floormod(x, c2), c2.Eval()->value > 0 && c1.Eval()->value % c2.Eval()->value == 0); + TVM_TRY_REWRITE_IF(floormod(x * c1 + y, c2), floormod(x, floordiv(c2, c1)) * c1 + y, + c1.Eval()->value > 0 && c2.Eval()->value > 0 && + c2.Eval()->value % c1.Eval()->value == 0 && + CanProveGreaterEqual(-y.Eval(), -c1.Eval()->value + 1)); + + // TODO(jcf94): For the next two rules, better use the max common factor + // of c1, c2, c3 to do the simplification Review comment: Emm ... Unfortunately these rules seemed to cause another simplify error int the UT(see jenkins tests), I'll try to see if we can figure out a better way rule to solve it fine. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org