[llvm] [perf] Replace copy-assign by move-assign in llvm/tools/ (PR #179463)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 3 06:16:18 PST 2026


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

>From ce75feadf48f2b6b8aa52777740d2496ca037974 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton at mozilla.com>
Date: Tue, 3 Feb 2026 14:54:20 +0100
Subject: [PATCH 1/2] [perf] Replace copy-assign by move-assign in llvm/tools/

---
 llvm/tools/llvm-objdump/SourcePrinter.cpp | 2 +-
 llvm/tools/obj2yaml/dwarf2yaml.cpp        | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/tools/llvm-objdump/SourcePrinter.cpp b/llvm/tools/llvm-objdump/SourcePrinter.cpp
index a4891a3620ee9..a92b955a49cde 100644
--- a/llvm/tools/llvm-objdump/SourcePrinter.cpp
+++ b/llvm/tools/llvm-objdump/SourcePrinter.cpp
@@ -688,7 +688,7 @@ void SourcePrinter::printSourceLine(formatted_raw_ostream &OS,
     printLines(OS, Address, LineInfo, Delimiter, LEP);
   if (PrintSource)
     printSources(OS, LineInfo, ObjectFilename, Delimiter, LEP);
-  OldLineInfo = LineInfo;
+  OldLineInfo = std::move(LineInfo);
 }
 
 void SourcePrinter::printLines(formatted_raw_ostream &OS,
diff --git a/llvm/tools/obj2yaml/dwarf2yaml.cpp b/llvm/tools/obj2yaml/dwarf2yaml.cpp
index f19004bdcde38..9aea81bc45a4e 100644
--- a/llvm/tools/obj2yaml/dwarf2yaml.cpp
+++ b/llvm/tools/obj2yaml/dwarf2yaml.cpp
@@ -97,7 +97,7 @@ Error dumpDebugStrings(DWARFContext &DCtx, DWARFYAML::Data &Y) {
     DebugStr.push_back(CStr);
   }
 
-  Y.DebugStrings = DebugStr;
+  Y.DebugStrings = std::move(DebugStr);
   return Err;
 }
 
@@ -132,7 +132,7 @@ Error dumpDebugARanges(DWARFContext &DCtx, DWARFYAML::Data &Y) {
     DebugAranges.push_back(Range);
   }
 
-  Y.DebugAranges = DebugAranges;
+  Y.DebugAranges = std::move(DebugAranges);
   return ErrorSuccess();
 }
 
@@ -166,7 +166,7 @@ Error dumpDebugRanges(DWARFContext &DCtx, DWARFYAML::Data &Y) {
     DebugRanges.push_back(std::move(YamlRanges));
   }
 
-  Y.DebugRanges = DebugRanges;
+  Y.DebugRanges = std::move(DebugRanges);
   return ErrorSuccess();
 }
 

>From 6bcfa839feffee03e1f696e1a348b9471393ed8a Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton at mozilla.com>
Date: Tue, 3 Feb 2026 15:15:52 +0100
Subject: [PATCH 2/2] fixup! [perf] Replace copy-assign by move-assign in
 llvm/tools/

---
 llvm/tools/obj2yaml/dwarf2yaml.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/tools/obj2yaml/dwarf2yaml.cpp b/llvm/tools/obj2yaml/dwarf2yaml.cpp
index 9aea81bc45a4e..f19004bdcde38 100644
--- a/llvm/tools/obj2yaml/dwarf2yaml.cpp
+++ b/llvm/tools/obj2yaml/dwarf2yaml.cpp
@@ -97,7 +97,7 @@ Error dumpDebugStrings(DWARFContext &DCtx, DWARFYAML::Data &Y) {
     DebugStr.push_back(CStr);
   }
 
-  Y.DebugStrings = std::move(DebugStr);
+  Y.DebugStrings = DebugStr;
   return Err;
 }
 
@@ -132,7 +132,7 @@ Error dumpDebugARanges(DWARFContext &DCtx, DWARFYAML::Data &Y) {
     DebugAranges.push_back(Range);
   }
 
-  Y.DebugAranges = std::move(DebugAranges);
+  Y.DebugAranges = DebugAranges;
   return ErrorSuccess();
 }
 
@@ -166,7 +166,7 @@ Error dumpDebugRanges(DWARFContext &DCtx, DWARFYAML::Data &Y) {
     DebugRanges.push_back(std::move(YamlRanges));
   }
 
-  Y.DebugRanges = std::move(DebugRanges);
+  Y.DebugRanges = DebugRanges;
   return ErrorSuccess();
 }
 



More information about the llvm-commits mailing list