Author: Kazu Hirata Date: 2022-07-24T16:21:29-07:00 New Revision: acf648b5e91b6ccbb6e29a6db344e8d8ae0fbdb7
URL: https://github.com/llvm/llvm-project/commit/acf648b5e91b6ccbb6e29a6db344e8d8ae0fbdb7 DIFF: https://github.com/llvm/llvm-project/commit/acf648b5e91b6ccbb6e29a6db344e8d8ae0fbdb7.diff LOG: Use llvm::less_first and llvm::less_second (NFC) Added: Modified: 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 Removed: ################################################################################ diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp index f8443d608ac3a..26775e72669f8 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -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)); diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index bed684b7652a3..aa35f253bc5f0 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -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; diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp index 83336e69a7bd8..191596dbf53e6 100644 --- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp +++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp @@ -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) { diff --git a/llvm/lib/Target/DirectX/DXILWriter/DXILValueEnumerator.cpp b/llvm/lib/Target/DirectX/DXILWriter/DXILValueEnumerator.cpp index e2a41515de389..a873662f730d6 100644 --- a/llvm/lib/Target/DirectX/DXILWriter/DXILValueEnumerator.cpp +++ b/llvm/lib/Target/DirectX/DXILWriter/DXILValueEnumerator.cpp @@ -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; diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp index 62cfc32949681..48ec7eb9191ed 100644 --- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp +++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -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; diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index ec26db8bfc0b4..6df0409256bbd 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -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; diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index cd044c78d9004..d69d1e3d19f39 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -10972,9 +10972,7 @@ class HorizontalReduction { 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); } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits