[llvm] [perf] Replace copy-assign by move-assign in llvm/lib/IR/* (PR #178175)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 27 03:56:19 PST 2026


https://github.com/serge-sans-paille created https://github.com/llvm/llvm-project/pull/178175

None

>From c85b6b01a629b2e31ef255765bed3f0a2a00b248 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton at mozilla.com>
Date: Tue, 27 Jan 2026 11:08:15 +0100
Subject: [PATCH] [perf] Replace copy-assign by move-assign in llvm/lib/IR/*

---
 llvm/lib/IR/AsmWriter.cpp         | 8 ++++----
 llvm/lib/IR/ConstantRangeList.cpp | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 82e4de6d07441..b3e0323fd8633 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -1010,13 +1010,13 @@ int ModuleSlotTracker::getLocalSlot(const Value *V) {
 void ModuleSlotTracker::setProcessHook(
     std::function<void(AbstractSlotTrackerStorage *, const Module *, bool)>
         Fn) {
-  ProcessModuleHookFn = Fn;
+  ProcessModuleHookFn = std::move(Fn);
 }
 
 void ModuleSlotTracker::setProcessHook(
     std::function<void(AbstractSlotTrackerStorage *, const Function *, bool)>
         Fn) {
-  ProcessFunctionHookFn = Fn;
+  ProcessFunctionHookFn = std::move(Fn);
 }
 
 static SlotTracker *createSlotTracker(const Value *V) {
@@ -1304,13 +1304,13 @@ int SlotTracker::getGlobalSlot(const GlobalValue *V) {
 void SlotTracker::setProcessHook(
     std::function<void(AbstractSlotTrackerStorage *, const Module *, bool)>
         Fn) {
-  ProcessModuleHookFn = Fn;
+  ProcessModuleHookFn = std::move(Fn);
 }
 
 void SlotTracker::setProcessHook(
     std::function<void(AbstractSlotTrackerStorage *, const Function *, bool)>
         Fn) {
-  ProcessFunctionHookFn = Fn;
+  ProcessFunctionHookFn = std::move(Fn);
 }
 
 /// getMetadataSlot - Get the slot number of a MDNode.
diff --git a/llvm/lib/IR/ConstantRangeList.cpp b/llvm/lib/IR/ConstantRangeList.cpp
index 3ee8d6f22b748..d41efe9dbae2b 100644
--- a/llvm/lib/IR/ConstantRangeList.cpp
+++ b/llvm/lib/IR/ConstantRangeList.cpp
@@ -139,7 +139,7 @@ void ConstantRangeList::subtract(const ConstantRange &SubRange) {
     }
   }
 
-  Ranges = Result;
+  Ranges = std::move(Result);
 }
 
 ConstantRangeList



More information about the llvm-commits mailing list