[PATCH] D125483: [BOLT][NFC] Use refs for loop variables to avoid copies
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 13 12:18:38 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG253b8f0abd66: [BOLT][NFC] Use refs for loop variables to avoid copies (authored by Amir).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125483/new/
https://reviews.llvm.org/D125483
Files:
bolt/lib/Core/BinaryFunction.cpp
bolt/lib/Profile/DataReader.cpp
bolt/lib/Rewrite/BoltDiff.cpp
Index: bolt/lib/Rewrite/BoltDiff.cpp
===================================================================
--- bolt/lib/Rewrite/BoltDiff.cpp
+++ bolt/lib/Rewrite/BoltDiff.cpp
@@ -219,7 +219,7 @@
const BinaryFunction &Function = BFI.second;
const double Score = getNormalizedScore(Function, RI1);
LargestBin1.insert(std::make_pair<>(Score, &Function));
- for (const StringRef Name : Function.getNames()) {
+ for (const StringRef &Name : Function.getNames()) {
if (Optional<StringRef> OptionalLTOName = getLTOCommonName(Name))
LTOName = *OptionalLTOName;
NameLookup[Name] = &Function;
@@ -239,7 +239,7 @@
const BinaryFunction &Function = BFI.second;
const double Score = getNormalizedScore(Function, RI2);
LargestBin2.insert(std::make_pair<>(Score, &Function));
- for (const StringRef Name : Function.getNames()) {
+ for (const StringRef &Name : Function.getNames()) {
if (Optional<StringRef> OptionalLTOName = getLTOCommonName(Name))
LTOName = *OptionalLTOName;
}
@@ -261,7 +261,7 @@
const BinaryFunction &Function2 = BFI2.second;
StringRef LTOName;
bool Match = false;
- for (const StringRef Name : Function2.getNames()) {
+ for (const StringRef &Name : Function2.getNames()) {
auto Iter = NameLookup.find(Name);
if (Optional<StringRef> OptionalLTOName = getLTOCommonName(Name))
LTOName = *OptionalLTOName;
Index: bolt/lib/Profile/DataReader.cpp
===================================================================
--- bolt/lib/Profile/DataReader.cpp
+++ bolt/lib/Profile/DataReader.cpp
@@ -56,7 +56,7 @@
/// Return true if the function name can change across compilations.
bool hasVolatileName(const BinaryFunction &BF) {
- for (const StringRef Name : BF.getNames())
+ for (const StringRef &Name : BF.getNames())
if (getLTOCommonName(Name))
return true;
Index: bolt/lib/Core/BinaryFunction.cpp
===================================================================
--- bolt/lib/Core/BinaryFunction.cpp
+++ bolt/lib/Core/BinaryFunction.cpp
@@ -419,7 +419,7 @@
if (AllNames.size() > 1) {
OS << "\n All names : ";
const char *Sep = "";
- for (const StringRef Name : AllNames) {
+ for (const StringRef &Name : AllNames) {
OS << Sep << Name;
Sep = "\n ";
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125483.429324.patch
Type: text/x-patch
Size: 2401 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220513/ae23ebd5/attachment.bin>
More information about the llvm-commits
mailing list