areusch commented on code in PR #11498:
URL: https://github.com/apache/tvm/pull/11498#discussion_r885933590


##########
src/ir/transform.cc:
##########
@@ -264,11 +267,31 @@ IRModule Pass::operator()(IRModule mod, const 
PassContext& pass_ctx) const {
                << " with opt level: " << pass_info->opt_level;
     return mod;
   }
-  auto ret = node->operator()(std::move(mod), pass_ctx);
+  IRModule ret;
+  if (pass_ctx->GetConfig<Bool>("testing.immutable_module", 
Bool(false)).value()) {
+    ret = Pass::AssertImmutableModule(mod, node, pass_ctx);
+  } else {
+    ret = node->operator()(std::move(mod), pass_ctx);
+  }
   pass_ctx.InstrumentAfterPass(ret, pass_info);
   return std::move(ret);
 }
 
+IRModule Pass::AssertImmutableModule(const IRModule& mod, const PassNode* node,

Review Comment:
   suggest not taking `const IRModule&`--instead take `IRModule`. right now 
this is basically re-implemeting the copy constructor rather than just using it



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