From 22d20d62ccda64f7af3956ce9e8763cd4f279d3a Mon Sep 17 00:00:00 2001 From: Wuwei Lin Date: Wed, 27 Jul 2022 13:54:00 -0700 Subject: [PATCH] Use std::move to avoid warnings on clang-13 (#12196) --- src/relay/backend/vm/manifest_lifetimes.cc | 2 +- src/relay/quantize/calibrate.cc | 2 +- src/relay/transforms/device_planner.cc | 2 +- src/te/operation/create_primfunc.cc | 2 +- src/tir/schedule/primitive/blockize_tensorize.cc | 2 +- src/tir/schedule/primitive/cache_read_write.cc | 6 +++--- src/tir/transforms/flatten_buffer.cc | 4 ++-- src/tir/transforms/remove_weight_layout_rewrite_block.cc | 2 +- src/tir/usmp/transform/assign_pool_info.cc | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/relay/backend/vm/manifest_lifetimes.cc b/src/relay/backend/vm/manifest_lifetimes.cc index 486e06320345..7028c88f2e15 100644 --- a/src/relay/backend/vm/manifest_lifetimes.cc +++ b/src/relay/backend/vm/manifest_lifetimes.cc @@ -201,7 +201,7 @@ class AliasEliminator : public MixedModeMutator { if (alias_.count(var)) { return alias_[var]; } - return var; + return std::move(var); } Expr VisitExpr_(const FunctionNode* func_node) override { diff --git a/src/relay/quantize/calibrate.cc b/src/relay/quantize/calibrate.cc index 21ed61187c38..2b831ee1403f 100644 --- a/src/relay/quantize/calibrate.cc +++ b/src/relay/quantize/calibrate.cc @@ -158,7 +158,7 @@ class StatsCollector : private ExprMutator { // indistinguishable from NullValue(), so we can't express "update to nullptr" in // WithFields. ret_func.CopyOnWrite()->ret_type = NullValue(); - return ret_func; + return std::move(ret_func); } private: diff --git a/src/relay/transforms/device_planner.cc b/src/relay/transforms/device_planner.cc index 6ccbe38dbebf..bf7839dfa48f 100644 --- a/src/relay/transforms/device_planner.cc +++ b/src/relay/transforms/device_planner.cc @@ -1026,7 +1026,7 @@ class DeviceCapturer : public ExprMutator { VLOG(4) << "Func with bound params: " << func; func->virtual_device_ = result_virtual_device; VLOG(4) << "Func with bound params & result vid set: " << func; - return func; + return std::move(func); } Expr VisitExpr_(const CallNode* call_node) final { diff --git a/src/te/operation/create_primfunc.cc b/src/te/operation/create_primfunc.cc index e361e8e3441f..68b25a165373 100644 --- a/src/te/operation/create_primfunc.cc +++ b/src/te/operation/create_primfunc.cc @@ -118,7 +118,7 @@ class LayoutFreePlaceholdersNormalizer : public StmtMutator { } block.CopyOnWrite()->annotations.erase(topi_attr); } - return block; + return std::move(block); } std::unordered_map buffer2index_; diff --git a/src/tir/schedule/primitive/blockize_tensorize.cc b/src/tir/schedule/primitive/blockize_tensorize.cc index 9c3029ebf513..cf6532e82d46 100644 --- a/src/tir/schedule/primitive/blockize_tensorize.cc +++ b/src/tir/schedule/primitive/blockize_tensorize.cc @@ -374,7 +374,7 @@ Stmt Substitute(const Stmt& stmt, const Map& sub, if (!src.same_as(tgt)) { block_sref_reuse_->Set(src, tgt); } - return tgt; + return std::move(tgt); } const Map& sub_; diff --git a/src/tir/schedule/primitive/cache_read_write.cc b/src/tir/schedule/primitive/cache_read_write.cc index d28a659fd7f8..c3b8fd67661b 100644 --- a/src/tir/schedule/primitive/cache_read_write.cc +++ b/src/tir/schedule/primitive/cache_read_write.cc @@ -888,7 +888,7 @@ class ReIndexRewriter : public StmtExprMutator { n->alloc_buffers.push_back(info_->alloc); stmt = Block(n); info_->block_reuse.Set(old_stmt, stmt); - return stmt; + return std::move(stmt); } // Visiting the blokc being reindexed @@ -917,9 +917,9 @@ class ReIndexRewriter : public StmtExprMutator { stmt = Block(n); } info_->block_reuse.Set(old_stmt, stmt); - return stmt; + return std::move(stmt); } - return old_stmt; + return std::move(old_stmt); } template diff --git a/src/tir/transforms/flatten_buffer.cc b/src/tir/transforms/flatten_buffer.cc index dcc23a72b27b..22aef136bcff 100644 --- a/src/tir/transforms/flatten_buffer.cc +++ b/src/tir/transforms/flatten_buffer.cc @@ -107,9 +107,9 @@ class BufferFlattener : public StmtExprMutator { << "Expected int8 backing array for boolean tensor"; auto writer = store.CopyOnWrite(); writer->value = tvm::cast(DataType::Int(8), store->value); - return store; + return std::move(store); } - return store; + return std::move(store); } PrimExpr VisitExpr_(const BufferLoadNode* op) final { diff --git a/src/tir/transforms/remove_weight_layout_rewrite_block.cc b/src/tir/transforms/remove_weight_layout_rewrite_block.cc index 5f47e670c6c3..8b2759579b72 100644 --- a/src/tir/transforms/remove_weight_layout_rewrite_block.cc +++ b/src/tir/transforms/remove_weight_layout_rewrite_block.cc @@ -69,7 +69,7 @@ class WeightLayoutRewriteBlockRemover : public StmtMutator { n->alloc_buffers = std::move(alloc_buffers); return Stmt(n); } else { - return block; + return std::move(block); } } diff --git a/src/tir/usmp/transform/assign_pool_info.cc b/src/tir/usmp/transform/assign_pool_info.cc index 52d2f0ef541e..0671f1ea2722 100644 --- a/src/tir/usmp/transform/assign_pool_info.cc +++ b/src/tir/usmp/transform/assign_pool_info.cc @@ -140,7 +140,7 @@ Stmt PoolInfoAssigner::VisitStmt_(const AllocateNode* op) { Stmt body = VisitStmt(op->body); auto allocate = Allocate(op->buffer_var, op->dtype, op->extents, op->condition, body, annotations); - return allocate; + return std::move(allocate); } Stmt PoolInfoAssigner::VisitStmt_(const AllocateConstNode* op) { @@ -157,7 +157,7 @@ Stmt PoolInfoAssigner::VisitStmt_(const AllocateConstNode* op) { Stmt body = VisitStmt(op->body); auto allocate_const = AllocateConst(op->buffer_var, op->dtype, op->extents, op->data, body, annotations); - return allocate_const; + return std::move(allocate_const); } IRModule PoolInfoAssigner::operator()() {