[llvm] 5543d9d - [RegAlloc][NFC] Use `std::move` to avoid copy (#134533)

via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 10 02:15:05 PDT 2025


Author: Abhishek Kaushik
Date: 2025-04-10T14:45:02+05:30
New Revision: 5543d9ded7330b21c1d52cdeafadc4b95a495ccc

URL: https://github.com/llvm/llvm-project/commit/5543d9ded7330b21c1d52cdeafadc4b95a495ccc
DIFF: https://github.com/llvm/llvm-project/commit/5543d9ded7330b21c1d52cdeafadc4b95a495ccc.diff

LOG: [RegAlloc][NFC] Use `std::move` to  avoid copy (#134533)

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/RegAllocFast.h
    llvm/include/llvm/CodeGen/RegAllocGreedyPass.h
    llvm/lib/CodeGen/RegAllocGreedy.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/RegAllocFast.h b/llvm/include/llvm/CodeGen/RegAllocFast.h
index 9fdaca09e4317..83b9125dc07e9 100644
--- a/llvm/include/llvm/CodeGen/RegAllocFast.h
+++ b/llvm/include/llvm/CodeGen/RegAllocFast.h
@@ -22,10 +22,10 @@ class RegAllocFastPass : public PassInfoMixin<RegAllocFastPass> {
     bool ClearVRegs;
     Options(RegAllocFilterFunc F = nullptr, StringRef FN = "all",
             bool CV = true)
-        : Filter(F), FilterName(FN), ClearVRegs(CV) {}
+        : Filter(std::move(F)), FilterName(FN), ClearVRegs(CV) {}
   };
 
-  RegAllocFastPass(Options Opts = Options()) : Opts(Opts) {}
+  RegAllocFastPass(Options Opts = Options()) : Opts(std::move(Opts)) {}
 
   MachineFunctionProperties getRequiredProperties() const {
     return MachineFunctionProperties().set(

diff  --git a/llvm/include/llvm/CodeGen/RegAllocGreedyPass.h b/llvm/include/llvm/CodeGen/RegAllocGreedyPass.h
index 1281ca851f069..d2fd66f8da593 100644
--- a/llvm/include/llvm/CodeGen/RegAllocGreedyPass.h
+++ b/llvm/include/llvm/CodeGen/RegAllocGreedyPass.h
@@ -21,10 +21,10 @@ class RAGreedyPass : public PassInfoMixin<RAGreedyPass> {
     RegAllocFilterFunc Filter;
     StringRef FilterName;
     Options(RegAllocFilterFunc F = nullptr, StringRef FN = "all")
-        : Filter(F), FilterName(FN) {};
+        : Filter(std::move(F)), FilterName(FN) {};
   };
 
-  RAGreedyPass(Options Opts = Options()) : Opts(Opts) {}
+  RAGreedyPass(Options Opts = Options()) : Opts(std::move(Opts)) {}
   PreservedAnalyses run(MachineFunction &F, MachineFunctionAnalysisManager &AM);
 
   MachineFunctionProperties getRequiredProperties() const {

diff  --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp
index a5cd9fc7a5360..56d3bd953f57d 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -179,7 +179,7 @@ class RAGreedyLegacy : public MachineFunctionPass {
 } // end anonymous namespace
 
 RAGreedyLegacy::RAGreedyLegacy(const RegAllocFilterFunc F)
-    : MachineFunctionPass(ID), F(F) {
+    : MachineFunctionPass(ID), F(std::move(F)) {
   initializeRAGreedyLegacyPass(*PassRegistry::getPassRegistry());
 }
 


        


More information about the llvm-commits mailing list