tqchen commented on code in PR #17765:
URL: https://github.com/apache/tvm/pull/17765#discussion_r2003689582
##########
src/arith/rewrite_simplify.cc:
##########
@@ -1230,7 +1230,8 @@ PrimExpr RewriteSimplifier::Impl::VisitExpr_(const
FloorModNode* op) {
TVM_TRY_REWRITE_IF(floormod(x + y * c1, c2), floormod(x + y * floormod(c1,
c2), c2),
c2.Eval()->value > 0);
- TVM_TRY_REWRITE_IF(floormod(x * c1, x * c2), x * floormod(c1, c2),
c2.Eval()->value != 0);
+ TVM_TRY_REWRITE_IF(matches_one_of(floormod(x * c1, x * c2), floormod(c1 *
x, c2 * x)),
+ floormod(c1, c2), c2.Eval()->value != 0);
Review Comment:
I am a bit surprised to see if we need c * x case since canonical simplify
will move most cases to x * c
##########
src/arith/rewrite_simplify.cc:
##########
@@ -1230,7 +1230,8 @@ PrimExpr RewriteSimplifier::Impl::VisitExpr_(const
FloorModNode* op) {
TVM_TRY_REWRITE_IF(floormod(x + y * c1, c2), floormod(x + y * floormod(c1,
c2), c2),
c2.Eval()->value > 0);
- TVM_TRY_REWRITE_IF(floormod(x * c1, x * c2), x * floormod(c1, c2),
c2.Eval()->value != 0);
+ TVM_TRY_REWRITE_IF(matches_one_of(floormod(x * c1, x * c2), floormod(c1 *
x, c2 * x)),
+ floormod(c1, c2), c2.Eval()->value != 0);
Review Comment:
Thank you, can you describe the usecase?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]