From f1bf67fa054ec31f5ba96ff75348da910b7c55e2 Mon Sep 17 00:00:00 2001 From: enkilee Date: Mon, 5 Feb 2024 13:53:28 +0800 Subject: [PATCH 1/2] clangtidy 27 --- paddle/fluid/pir/dialect/operator/ir/ir_tensor.cc | 4 ++-- paddle/phi/core/dense_tensor.cc | 2 +- paddle/phi/core/distributed/auto_parallel/inferspmd_utils.cc | 2 +- paddle/phi/core/tensor_meta.cc | 4 ++-- test/cpp/phi/core/test_dense_tensor.cc | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/paddle/fluid/pir/dialect/operator/ir/ir_tensor.cc b/paddle/fluid/pir/dialect/operator/ir/ir_tensor.cc index 6383257647323..131a8b1848bd4 100644 --- a/paddle/fluid/pir/dialect/operator/ir/ir_tensor.cc +++ b/paddle/fluid/pir/dialect/operator/ir/ir_tensor.cc @@ -43,10 +43,10 @@ IrTensor& IrTensor::operator=(const IrTensor& other) { } IrTensor& IrTensor::operator=(IrTensor&& other) noexcept { - dims_ = std::move(other.dims()); + dims_ = other.dims(); dtype_ = other.dtype(); layout_ = other.layout(); - lod_ = std::move(other.lod()); + lod_ = other.lod(); offset_ = other.offset(); return *this; } diff --git a/paddle/phi/core/dense_tensor.cc b/paddle/phi/core/dense_tensor.cc index 205bd0614bf3e..d15cc4eeafda1 100644 --- a/paddle/phi/core/dense_tensor.cc +++ b/paddle/phi/core/dense_tensor.cc @@ -47,7 +47,7 @@ DenseTensor::DenseTensor(Allocator* a, const DenseTensorMeta& meta) : meta_(meta), holder_(a->Allocate(SizeOf(dtype()) * numel())) {} DenseTensor::DenseTensor(Allocator* a, DenseTensorMeta&& meta) - : meta_(std::move(meta)), holder_(a->Allocate(SizeOf(dtype()) * numel())) {} + : meta_(meta), holder_(a->Allocate(SizeOf(dtype()) * numel())) {} DenseTensor::DenseTensor(const std::shared_ptr& holder, const DenseTensorMeta& meta) diff --git a/paddle/phi/core/distributed/auto_parallel/inferspmd_utils.cc b/paddle/phi/core/distributed/auto_parallel/inferspmd_utils.cc index 56a9d618fec3e..e8d7da026e518 100644 --- a/paddle/phi/core/distributed/auto_parallel/inferspmd_utils.cc +++ b/paddle/phi/core/distributed/auto_parallel/inferspmd_utils.cc @@ -144,7 +144,7 @@ bool SpmdRuleFactory::ContainsSpmdRule(const std::string& kernel_name) const { } int SpmdRuleFactory::InsertSpmdRule(std::string kernel_name, SpmdRule rule) { - spmd_rule_map_.insert({std::move(kernel_name), std::move(rule)}); + spmd_rule_map_.insert({std::move(kernel_name), rule}); return 0; } diff --git a/paddle/phi/core/tensor_meta.cc b/paddle/phi/core/tensor_meta.cc index d44ab61a59cd9..2134b2c3936ef 100644 --- a/paddle/phi/core/tensor_meta.cc +++ b/paddle/phi/core/tensor_meta.cc @@ -187,7 +187,7 @@ DenseTensorMeta& DenseTensorMeta::operator=( // NOLINT DenseTensorMeta&& other) { is_scalar = other.is_scalar; use_gpudnn = other.use_gpudnn; - dims = std::move(other.dims); + dims = other.dims; dtype = other.dtype; layout = other.layout; lod = std::move(other.lod); @@ -195,7 +195,7 @@ DenseTensorMeta& DenseTensorMeta::operator=( // NOLINT if (other.strides.size() == -1) { strides == calc_strides(dims); } else { - strides = std::move(other.strides); + strides = other.strides; } return *this; } diff --git a/test/cpp/phi/core/test_dense_tensor.cc b/test/cpp/phi/core/test_dense_tensor.cc index 2f6be4e25018a..1e568b099f13b 100644 --- a/test/cpp/phi/core/test_dense_tensor.cc +++ b/test/cpp/phi/core/test_dense_tensor.cc @@ -55,7 +55,7 @@ TEST(dense_tensor, meta) { CHECK(meta_4.lod == lod); CHECK(meta_4.valid()); - DenseTensorMeta meta_5(std::move(meta_4)); + DenseTensorMeta meta_5((meta_4); CHECK(meta_5.dtype == dtype); CHECK(meta_5.dims == dims); CHECK(meta_5.layout == layout); From a7bc95a3dd52e3fd5a67109ff4aafaa15fbfa327 Mon Sep 17 00:00:00 2001 From: enkilee Date: Tue, 6 Feb 2024 09:53:53 +0800 Subject: [PATCH 2/2] fix --- test/cpp/phi/core/test_dense_tensor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cpp/phi/core/test_dense_tensor.cc b/test/cpp/phi/core/test_dense_tensor.cc index 1e568b099f13b..6a338a3abd0cf 100644 --- a/test/cpp/phi/core/test_dense_tensor.cc +++ b/test/cpp/phi/core/test_dense_tensor.cc @@ -55,7 +55,7 @@ TEST(dense_tensor, meta) { CHECK(meta_4.lod == lod); CHECK(meta_4.valid()); - DenseTensorMeta meta_5((meta_4); + DenseTensorMeta meta_5(meta_4); CHECK(meta_5.dtype == dtype); CHECK(meta_5.dims == dims); CHECK(meta_5.layout == layout);