[llvm] [perf] Replace copy-assign by move-assign in llvm/lib/Support/* (PR #178167)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 27 03:50:21 PST 2026
https://github.com/serge-sans-paille created https://github.com/llvm/llvm-project/pull/178167
None
>From 58e1fecaa257e2054b36132e07ac7ca8de96a258 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton at mozilla.com>
Date: Tue, 27 Jan 2026 09:22:07 +0100
Subject: [PATCH] [perf] Replace copy-assign by move-assign in
llvm/lib/Support/*
---
llvm/lib/Support/KnownBits.cpp | 2 +-
llvm/lib/Support/Mustache.cpp | 4 ++--
llvm/lib/Support/Path.cpp | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/Support/KnownBits.cpp b/llvm/lib/Support/KnownBits.cpp
index b5d7006c8de2a..99d86ff1faac3 100644
--- a/llvm/lib/Support/KnownBits.cpp
+++ b/llvm/lib/Support/KnownBits.cpp
@@ -1251,7 +1251,7 @@ KnownBits KnownBits::urem(const KnownBits &LHS, const KnownBits &RHS) {
if (RHS.isConstant() && RHS.getConstant().isPowerOf2()) {
// NB: Low bits set in `remGetLowBits`.
APInt HighBits = ~(RHS.getConstant() - 1);
- Known.Zero |= HighBits;
+ Known.Zero |= std::move(HighBits);
return Known;
}
diff --git a/llvm/lib/Support/Mustache.cpp b/llvm/lib/Support/Mustache.cpp
index f27a647b9c67d..e02a31639d695 100644
--- a/llvm/lib/Support/Mustache.cpp
+++ b/llvm/lib/Support/Mustache.cpp
@@ -898,11 +898,11 @@ void Template::registerPartial(std::string Name, std::string Partial) {
}
void Template::registerLambda(std::string Name, Lambda L) {
- Ctx.Lambdas[Name] = L;
+ Ctx.Lambdas[Name] = std::move(L);
}
void Template::registerLambda(std::string Name, SectionLambda L) {
- Ctx.SectionLambdas[Name] = L;
+ Ctx.SectionLambdas[Name] = std::move(L);
}
void Template::overrideEscapeCharacters(EscapeMap E) {
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp
index 1e2d53196e923..a74beca5dcac3 100644
--- a/llvm/lib/Support/Path.cpp
+++ b/llvm/lib/Support/Path.cpp
@@ -559,7 +559,7 @@ void native(SmallVectorImpl<char> &Path, Style style) {
SmallString<128> PathHome;
home_directory(PathHome);
PathHome.append(Path.begin() + 1, Path.end());
- Path = PathHome;
+ Path = std::move(PathHome);
}
} else {
llvm::replace(Path, '\\', '/');
More information about the llvm-commits
mailing list