[PATCH] D128242: [BOLT][NFC] Use llvm::less_first

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 27 10:27:26 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc4302e4fc201: [BOLT][NFC] Use llvm::less_first (authored by Amir).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128242/new/

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
@@ -255,11 +255,7 @@
     for (auto &KeyVal : StubGroups) {
       for (StubTy &Elem : KeyVal.second)
         Elem.first = BBAddresses[Elem.second];
-      llvm::sort(KeyVal.second,
-                 [&](const std::pair<uint64_t, BinaryBasicBlock *> &LHS,
-                     const std::pair<uint64_t, BinaryBasicBlock *> &RHS) {
-                   return LHS.first < RHS.first;
-                 });
+      llvm::sort(KeyVal.second, llvm::less_first());
     }
   };
 
Index: bolt/lib/Core/DebugData.cpp
===================================================================
--- bolt/lib/Core/DebugData.cpp
+++ bolt/lib/Core/DebugData.cpp
@@ -313,10 +313,7 @@
   std::vector<IndexAddressPair> SortedMap(indexToAddressBegin(),
                                           indexToAdddessEnd());
   // Sorting address in increasing order of indices.
-  llvm::sort(SortedMap,
-             [](const IndexAddressPair &A, const IndexAddressPair &B) {
-               return A.first < B.first;
-             });
+  llvm::sort(SortedMap, llvm::less_first());
   for (auto &Pair : SortedMap)
     dbgs() << Twine::utohexstr(Pair.second) << "\t" << Pair.first << "\n";
 }
@@ -375,10 +372,7 @@
     std::vector<IndexAddressPair> SortedMap(AM->second.indexToAddressBegin(),
                                             AM->second.indexToAdddessEnd());
     // Sorting address in increasing order of indices.
-    llvm::sort(SortedMap,
-               [](const IndexAddressPair &A, const IndexAddressPair &B) {
-                 return A.first < B.first;
-               });
+    llvm::sort(SortedMap, llvm::less_first());
 
     uint8_t AddrSize = CU->getAddressByteSize();
     uint32_t Counter = 0;
@@ -449,10 +443,7 @@
         AMIter->second.indexToAddressBegin(),
         AMIter->second.indexToAdddessEnd());
     // Sorting address in increasing order of indices.
-    llvm::sort(SortedMap,
-               [](const IndexAddressPair &A, const IndexAddressPair &B) {
-                 return A.first < B.first;
-               });
+    llvm::sort(SortedMap, llvm::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.440300.patch
Type: text/x-patch
Size: 2389 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220627/eb5be205/attachment.bin>


More information about the llvm-commits mailing list