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

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 2 05:39:12 PST 2026


https://github.com/serge-sans-paille updated https://github.com/llvm/llvm-project/pull/178169

>From 249668b58ee3d3c3df5f3d3be436e6541dcb7283 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton at mozilla.com>
Date: Tue, 27 Jan 2026 09:35:33 +0100
Subject: [PATCH] [perf] Replace copy-assign by move-assign in
 llvm/lib/Analysis/*

---
 llvm/lib/Analysis/IVDescriptors.cpp      | 9 ++++-----
 llvm/lib/Analysis/InlineCost.cpp         | 2 +-
 llvm/lib/Analysis/LoopUnrollAnalyzer.cpp | 2 +-
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Analysis/IVDescriptors.cpp b/llvm/lib/Analysis/IVDescriptors.cpp
index 3946a7ce8b8f6..89490fee41754 100644
--- a/llvm/lib/Analysis/IVDescriptors.cpp
+++ b/llvm/lib/Analysis/IVDescriptors.cpp
@@ -656,11 +656,10 @@ bool RecurrenceDescriptor::AddReductionVar(
   // is saved as part of the RecurrenceDescriptor.
 
   // Save the description of this reduction variable.
-  RecurrenceDescriptor RD(RdxStart, ExitInstruction, IntermediateStore, Kind,
-                          FMF, ExactFPMathInst, RecurrenceType, IsSigned,
-                          IsOrdered, CastInsts, MinWidthCastToRecurrenceType);
-  RedDes = RD;
-
+  RedDes =
+      RecurrenceDescriptor(RdxStart, ExitInstruction, IntermediateStore, Kind,
+                           FMF, ExactFPMathInst, RecurrenceType, IsSigned,
+                           IsOrdered, CastInsts, MinWidthCastToRecurrenceType);
   return true;
 }
 
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 0e49b1903d410..8e99a4c352454 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -1728,7 +1728,7 @@ bool CallAnalyzer::canFoldInboundsGEP(GetElementPtrInst &I) {
     return false;
 
   // Add the result as a new mapping to Base + Offset.
-  ConstantOffsetPtrs[&I] = BaseAndOffset;
+  ConstantOffsetPtrs[&I] = std::move(BaseAndOffset);
 
   return true;
 }
diff --git a/llvm/lib/Analysis/LoopUnrollAnalyzer.cpp b/llvm/lib/Analysis/LoopUnrollAnalyzer.cpp
index 9c78e2afaede7..7c8e300c016ba 100644
--- a/llvm/lib/Analysis/LoopUnrollAnalyzer.cpp
+++ b/llvm/lib/Analysis/LoopUnrollAnalyzer.cpp
@@ -66,7 +66,7 @@ bool UnrolledInstAnalyzer::simplifyInstWithSCEV(Instruction *I) {
   SimplifiedAddress Address;
   Address.Base = Base->getValue();
   Address.Offset = *Offset;
-  SimplifiedAddresses[I] = Address;
+  SimplifiedAddresses[I] = std::move(Address);
   return false;
 }
 



More information about the llvm-commits mailing list