[llvm] Convert copies to rval references (PR #85743)

Malay Sanghi via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 00:17:55 PDT 2024


https://github.com/MalaySanghiIntel created https://github.com/llvm/llvm-project/pull/85743

None

>From 7e5c2d3a9d0c177195a029cdf4b5c1fcadcb4648 Mon Sep 17 00:00:00 2001
From: Malay Sanghi <malay.sanghi at intel.com>
Date: Mon, 18 Mar 2024 21:47:15 -0700
Subject: [PATCH] Convert copies to rval references

---
 llvm/include/llvm/IR/PassManagerInternal.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/include/llvm/IR/PassManagerInternal.h b/llvm/include/llvm/IR/PassManagerInternal.h
index 4ada6ee5dd6831..1f13b9b183cd40 100644
--- a/llvm/include/llvm/IR/PassManagerInternal.h
+++ b/llvm/include/llvm/IR/PassManagerInternal.h
@@ -69,7 +69,7 @@ struct PassConcept {
 template <typename IRUnitT, typename PassT, typename AnalysisManagerT,
           typename... ExtraArgTs>
 struct PassModel : PassConcept<IRUnitT, AnalysisManagerT, ExtraArgTs...> {
-  explicit PassModel(PassT Pass) : Pass(std::move(Pass)) {}
+  explicit PassModel(PassT &&Pass) : Pass(std::move(Pass)) {}
   // We have to explicitly define all the special member functions because MSVC
   // refuses to generate them.
   PassModel(const PassModel &Arg) : Pass(Arg.Pass) {}
@@ -198,7 +198,7 @@ template <typename IRUnitT, typename PassT, typename ResultT,
           typename InvalidatorT>
 struct AnalysisResultModel<IRUnitT, PassT, ResultT, InvalidatorT, false>
     : AnalysisResultConcept<IRUnitT, InvalidatorT> {
-  explicit AnalysisResultModel(ResultT Result) : Result(std::move(Result)) {}
+  explicit AnalysisResultModel(ResultT &&Result) : Result(std::move(Result)) {}
   // We have to explicitly define all the special member functions because MSVC
   // refuses to generate them.
   AnalysisResultModel(const AnalysisResultModel &Arg) : Result(Arg.Result) {}
@@ -236,7 +236,7 @@ template <typename IRUnitT, typename PassT, typename ResultT,
           typename InvalidatorT>
 struct AnalysisResultModel<IRUnitT, PassT, ResultT, InvalidatorT, true>
     : AnalysisResultConcept<IRUnitT, InvalidatorT> {
-  explicit AnalysisResultModel(ResultT Result) : Result(std::move(Result)) {}
+  explicit AnalysisResultModel(ResultT &&Result) : Result(std::move(Result)) {}
   // We have to explicitly define all the special member functions because MSVC
   // refuses to generate them.
   AnalysisResultModel(const AnalysisResultModel &Arg) : Result(Arg.Result) {}
@@ -290,7 +290,7 @@ template <typename IRUnitT, typename PassT, typename InvalidatorT,
           typename... ExtraArgTs>
 struct AnalysisPassModel
     : AnalysisPassConcept<IRUnitT, InvalidatorT, ExtraArgTs...> {
-  explicit AnalysisPassModel(PassT Pass) : Pass(std::move(Pass)) {}
+  explicit AnalysisPassModel(PassT &&Pass) : Pass(std::move(Pass)) {}
   // We have to explicitly define all the special member functions because MSVC
   // refuses to generate them.
   AnalysisPassModel(const AnalysisPassModel &Arg) : Pass(Arg.Pass) {}



More information about the llvm-commits mailing list