vinx13 commented on code in PR #11373:
URL: https://github.com/apache/tvm/pull/11373#discussion_r882216891


##########
src/arith/rewrite_simplify.cc:
##########
@@ -256,6 +256,14 @@ PrimExpr RewriteSimplifier::Impl::VisitExpr_(const 
SubNode* op) {
     TVM_TRY_REWRITE(broadcast(x, lanes) - broadcast(y, lanes), broadcast(x - 
y, lanes));
   }
 
+  // cancelation rules
+  TVM_TRY_REWRITE_IF(x - x, ZeroWithTypeLike(x),
+                     SideEffect(x.Eval()) <= CallEffectKind::kReadState);
+  TVM_TRY_REWRITE_IF((x + y) - y, x, SideEffect(y.Eval()) <= 
CallEffectKind::kReadState);
+  TVM_TRY_REWRITE_IF((x + y) - x, y, SideEffect(x.Eval()) <= 
CallEffectKind::kReadState);
+  TVM_TRY_REWRITE_IF(x - (y + x), 0 - y, SideEffect(x.Eval()) <= 
CallEffectKind::kReadState);
+  TVM_TRY_REWRITE_IF(x - (x + y), 0 - y, SideEffect(x.Eval()) <= 
CallEffectKind::kReadState);
+

Review Comment:
   should this be removed since you've added the else branch?



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