shingjan commented on code in PR #12749:
URL: https://github.com/apache/tvm/pull/12749#discussion_r970115341


##########
src/arith/rewrite_simplify.cc:
##########
@@ -1667,6 +1667,22 @@ PrimExpr RewriteSimplifier::Impl::VisitExpr_(const 
CallNode* op) {
       return match.value();
     }
   }
+  if (op->op.same_as(tir::builtin::if_then_else())) {
+    // Simplify nested if_then_else
+    const PrimExpr& cond = op->args[0];
+    const PrimExpr& then_expr = op->args[1];
+    const PrimExpr& else_expr = op->args[2];
+    const CallNode* inner_call = then_expr.as<CallNode>();
+    if (inner_call != nullptr && 
inner_call->op.same_as(tir::builtin::if_then_else())) {

Review Comment:
   Overall LGTM. I wonder if this implies that only one level of nested 
if_then_else could exist in current TIR structure.



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