junrushao1994 commented on a change in pull request #5585: URL: https://github.com/apache/incubator-tvm/pull/5585#discussion_r426200217
########## File path: src/te/schedule/schedule_lang.cc ########## @@ -267,10 +272,12 @@ Stage& Stage::fuse(const Array<IterVar>& axes, IterVar* p_target) { // NOLINT(* IterVar singleton = IterVarNode::make(Range::make_by_min_extent(0, 1), Var("singleton", DataType::Int(32)), kDataPar); self->relations.push_back(SingletonNode::make(singleton)); - ArrayNode* all_vars = self->all_iter_vars.CopyOnWrite(); - ArrayNode* leaf_vars = self->leaf_iter_vars.CopyOnWrite(); - all_vars->data.push_back(singleton); - leaf_vars->data.insert(leaf_vars->data.begin(), singleton); + Array<IterVar>& all_vars = self->all_iter_vars; + Array<IterVar>& leaf_vars = self->leaf_iter_vars; + all_vars.CopyOnWrite(); Review comment: Good point! Originally I was thinking that without `CopyOnWrite`, some raw pointer might be disabled silently when executing mutations like `push_back`, so I added it for better safety. In this file I think it is okay to add it back :-) ---------------------------------------------------------------- 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: us...@infra.apache.org