Use llvm::less_first and llvm::less_second (NFC)
authorKazu Hirata <kazu@google.com>
Sun, 24 Jul 2022 23:21:29 +0000 (16:21 -0700)
committerKazu Hirata <kazu@google.com>
Sun, 24 Jul 2022 23:21:29 +0000 (16:21 -0700)
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
llvm/lib/Analysis/LoopAccessAnalysis.cpp
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
llvm/lib/Target/DirectX/DXILWriter/DXILValueEnumerator.cpp
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
llvm/lib/Transforms/IPO/GlobalOpt.cpp
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

index f8443d608ac3a04755d9ff04466903ae9564b84d..26775e72669f888d1312ec4de345959d1e6373fd 100644 (file)
@@ -1430,9 +1430,7 @@ static bool ImportOffsetMap(llvm::DenseMap<const D *, O> &destination_map,
   std::vector<PairType> sorted_items;
   sorted_items.reserve(source_map.size());
   sorted_items.assign(source_map.begin(), source_map.end());
-  llvm::sort(sorted_items, [](const PairType &lhs, const PairType &rhs) {
-    return lhs.second < rhs.second;
-  });
+  llvm::sort(sorted_items, llvm::less_second());
 
   for (const auto &item : sorted_items) {
     DeclFromUser<D> user_decl(const_cast<D *>(item.first));
index bed684b7652a31d2ebe75afd12833f2141773bb0..aa35f253bc5f0f41979966d2d9641e90935e1500 100644 (file)
@@ -1500,9 +1500,7 @@ bool llvm::sortPtrAccesses(ArrayRef<Value *> VL, Type *ElemTy,
   Value *Ptr0 = VL[0];
 
   using DistOrdPair = std::pair<int64_t, int>;
-  auto Compare = [](const DistOrdPair &L, const DistOrdPair &R) {
-    return L.first < R.first;
-  };
+  auto Compare = llvm::less_first();
   std::set<DistOrdPair, decltype(Compare)> Offsets(Compare);
   Offsets.emplace(0, 0);
   int Cnt = 1;
index 83336e69a7bd8dcb60c6d4a62f3e81233b09c01f..191596dbf53e61e177681cc427a3bf84cf0c930f 100644 (file)
@@ -3136,8 +3136,7 @@ bool InstrRefBasedLDV::emitTransfers(
                         MI->getDebugLoc()->getInlinedAt());
       Insts.emplace_back(AllVarsNumbering.find(Var)->second, MI);
     }
-    llvm::sort(Insts,
-               [](const auto &A, const auto &B) { return A.first < B.first; });
+    llvm::sort(Insts, llvm::less_first());
 
     // Insert either before or after the designated point...
     if (P.MBB) {
index e2a41515de3896dcce16249ee020341584da8ed2..a873662f730d6f2fa723662e6b24de14c2898634 100644 (file)
@@ -260,9 +260,7 @@ static void predictValueUseListOrderImpl(const Value *V, const Function *F,
     return LU->getOperandNo() > RU->getOperandNo();
   });
 
-  if (llvm::is_sorted(List, [](const Entry &L, const Entry &R) {
-        return L.second < R.second;
-      }))
+  if (llvm::is_sorted(List, llvm::less_second()))
     // Order is already correct.
     return;
 
index 62cfc32949681be7c4773196ef11a485c8cc2c3e..48ec7eb9191edf5fe8ecef513ccd8fb87e779f07 100644 (file)
@@ -631,8 +631,7 @@ static bool findArgParts(Argument *Arg, const DataLayout &DL, AAResults &AAR,
 
   // Sort parts by offset.
   append_range(ArgPartsVec, ArgParts);
-  sort(ArgPartsVec,
-       [](const auto &A, const auto &B) { return A.first < B.first; });
+  sort(ArgPartsVec, llvm::less_first());
 
   // Make sure the parts are non-overlapping.
   int64_t Offset = ArgPartsVec[0].first;
index ec26db8bfc0b427581a77084a862aec351dc6024..6df0409256bbd3e0bef504e97d57abf1ec206cdc 100644 (file)
@@ -470,8 +470,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV, const DataLayout &DL) {
   // Sort by offset.
   SmallVector<std::pair<uint64_t, Type *>, 16> TypesVector;
   append_range(TypesVector, Types);
-  sort(TypesVector,
-       [](const auto &A, const auto &B) { return A.first < B.first; });
+  sort(TypesVector, llvm::less_first());
 
   // Check that the types are non-overlapping.
   uint64_t Offset = 0;
index cd044c78d90046e71826c87b25150ab500ab3945..d69d1e3d19f39e5508f3d57aae90b06d323dbae7 100644 (file)
@@ -10972,9 +10972,7 @@ public:
            It != E; ++It) {
         PossibleRedValsVect.emplace_back();
         auto RedValsVect = It->second.takeVector();
-        stable_sort(RedValsVect, [](const auto &P1, const auto &P2) {
-          return P1.second < P2.second;
-        });
+        stable_sort(RedValsVect, llvm::less_second());
         for (const std::pair<Value *, unsigned> &Data : RedValsVect)
           PossibleRedValsVect.back().append(Data.second, Data.first);
       }