wrongtest-intellif commented on code in PR #13933:
URL: https://github.com/apache/tvm/pull/13933#discussion_r1107949239


##########
src/arith/rewrite_simplify.cc:
##########
@@ -344,69 +355,47 @@ PrimExpr RewriteSimplifier::Impl::VisitExpr_(const 
SubNode* op) {
   if (IsIndexType(op->dtype)) {
     // Index rules
     // cancelation rules
-    TVM_TRY_REWRITE((x + y) - y, x);
-    TVM_TRY_REWRITE((x + y) - x, y);
-    TVM_TRY_REWRITE(x - (y + x), 0 - y);
-    TVM_TRY_REWRITE(x - (x + y), 0 - y);
+    TVM_TRY_REWRITE(matches_one_of((x + y) - y, (y + x) - y), x);
+    TVM_TRY_REWRITE(matches_one_of(x - (y + x), x - (x + y)), 0 - y);
 
-    TVM_TRY_REWRITE(min(x, y) - x, min(0, y - x));
-    TVM_TRY_REWRITE(min(x, y) - y, min(x - y, 0));
-    TVM_TRY_REWRITE(max(x, y) - x, max(0, y - x));
-    TVM_TRY_REWRITE(max(x, y) - y, max(x - y, 0));
-
-    TVM_TRY_REWRITE(x - max(x, y), min(0, x - y));
-    TVM_TRY_REWRITE(y - max(x, y), min(y - x, 0));
-    TVM_TRY_REWRITE(x - min(x, y), max(0, x - y));
-    TVM_TRY_REWRITE(y - min(x, y), max(y - x, 0));
+    TVM_TRY_REWRITE(matches_one_of(min(x, y) - y, x - max(y, x)), min(x - y, 
0));

Review Comment:
   the target of the rule line-361 and line-362's seems to be the same, is it 
intentional?



-- 
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]

Reply via email to