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


##########
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:
   Thank you for the catch, and they are now removed.



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