vinx13 commented on code in PR #12749:
URL: https://github.com/apache/tvm/pull/12749#discussion_r970167340
##########
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:
it supports multiple levels, as this mutator is recursive (`then_expr` here
is from the recursion result)
--
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]