You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/09/13 21:57:57 UTC

[GitHub] [tvm] shingjan commented on a diff in pull request #12749: [Arith] Simplify nested if_then_else

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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org