[PATCH] D128242: [BOLT][NFC] Use llvm::less_first
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 20 23:33:32 PDT 2022
Amir created this revision.
Herald added a reviewer: rafauler.
Herald added a subscriber: ayermolo.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.
Follow the case of https://reviews.llvm.org/D126068 and simplify call sites
with `llvm::less_first`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D128242
Files:
bolt/lib/Core/DebugData.cpp
bolt/lib/Passes/LongJmp.cpp
Index: bolt/lib/Passes/LongJmp.cpp
===================================================================
--- bolt/lib/Passes/LongJmp.cpp
+++ bolt/lib/Passes/LongJmp.cpp
@@ -254,11 +254,7 @@
for (auto &KeyVal : StubGroups) {
for (StubTy &Elem : KeyVal.second)
Elem.first = BBAddresses[Elem.second];
- sort(KeyVal.second,
- [&](const std::pair<uint64_t, BinaryBasicBlock *> &LHS,
- const std::pair<uint64_t, BinaryBasicBlock *> &RHS) {
- return LHS.first < RHS.first;
- });
+ sort(KeyVal.second, less_first());
}
};
Index: bolt/lib/Core/DebugData.cpp
===================================================================
--- bolt/lib/Core/DebugData.cpp
+++ bolt/lib/Core/DebugData.cpp
@@ -313,9 +313,7 @@
std::vector<IndexAddressPair> SortedMap(indexToAddressBegin(),
indexToAdddessEnd());
// Sorting address in increasing order of indices.
- sort(SortedMap, [](const IndexAddressPair &A, const IndexAddressPair &B) {
- return A.first < B.first;
- });
+ sort(SortedMap, less_first());
for (auto &Pair : SortedMap)
dbgs() << Twine::utohexstr(Pair.second) << "\t" << Pair.first << "\n";
}
@@ -374,9 +372,7 @@
std::vector<IndexAddressPair> SortedMap(AM->second.indexToAddressBegin(),
AM->second.indexToAdddessEnd());
// Sorting address in increasing order of indices.
- sort(SortedMap, [](const IndexAddressPair &A, const IndexAddressPair &B) {
- return A.first < B.first;
- });
+ sort(SortedMap, less_first());
uint8_t AddrSize = CU->getAddressByteSize();
uint32_t Counter = 0;
@@ -447,9 +443,7 @@
AMIter->second.indexToAddressBegin(),
AMIter->second.indexToAdddessEnd());
// Sorting address in increasing order of indices.
- sort(SortedMap, [](const IndexAddressPair &A, const IndexAddressPair &B) {
- return A.first < B.first;
- });
+ sort(SortedMap, less_first());
// Writing out Header
const uint32_t Length = SortedMap.size() * AddrSize + 4;
support::endian::write(AddressStream, Length, Endian);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128242.438566.patch
Type: text/x-patch
Size: 2178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220621/3450f56b/attachment.bin>
More information about the llvm-commits
mailing list