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 2021/01/28 02:02:41 UTC

[GitHub] [tvm] masahi commented on a change in pull request #7354: [Relay] Fold If when the Condition is Constant

masahi commented on a change in pull request #7354:
URL: https://github.com/apache/tvm/pull/7354#discussion_r565769392



##########
File path: src/relay/transforms/fold_constant.cc
##########
@@ -120,6 +120,18 @@ class ConstantFolder : public MixedModeMutator {
     }
   }
 
+  Expr VisitExpr_(const IfNode* op) final {
+    auto new_cond = ExprMutator::VisitExpr(op->cond);
+    if (auto const_cond = new_cond.as<ConstantNode>()) {
+      if (reinterpret_cast<uint8_t*>(const_cond->data->data)[0]) {

Review comment:
       there is no representation of `bool*`, things need to be byte-addressable




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

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