Index: include/llvm/Analysis/LoopInfoImpl.h =================================================================== --- include/llvm/Analysis/LoopInfoImpl.h +++ include/llvm/Analysis/LoopInfoImpl.h @@ -640,8 +640,8 @@ template bool compareVectors(std::vector &BB1, std::vector &BB2) { - llvm::sort(BB1.begin(), BB1.end()); - llvm::sort(BB2.begin(), BB2.end()); + llvm::sort(BB1); + llvm::sort(BB2); return BB1 == BB2; } Index: include/llvm/CodeGen/SlotIndexes.h =================================================================== --- include/llvm/CodeGen/SlotIndexes.h +++ include/llvm/CodeGen/SlotIndexes.h @@ -676,7 +676,7 @@ idx2MBBMap.push_back(IdxMBBPair(startIdx, mbb)); renumberIndexes(newItr); - llvm::sort(idx2MBBMap.begin(), idx2MBBMap.end(), Idx2MBBCompare()); + llvm::sort(idx2MBBMap, Idx2MBBCompare()); } /// Free the resources that were required to maintain a SlotIndex. Index: include/llvm/ProfileData/InstrProf.h =================================================================== --- include/llvm/ProfileData/InstrProf.h +++ include/llvm/ProfileData/InstrProf.h @@ -544,9 +544,9 @@ void InstrProfSymtab::finalizeSymtab() { if (Sorted) return; - llvm::sort(MD5NameMap.begin(), MD5NameMap.end(), less_first()); - llvm::sort(MD5FuncMap.begin(), MD5FuncMap.end(), less_first()); - llvm::sort(AddrToMD5Map.begin(), AddrToMD5Map.end(), less_first()); + llvm::sort(MD5NameMap, less_first()); + llvm::sort(MD5FuncMap, less_first()); + llvm::sort(AddrToMD5Map, less_first()); AddrToMD5Map.erase(std::unique(AddrToMD5Map.begin(), AddrToMD5Map.end()), AddrToMD5Map.end()); Sorted = true; Index: include/llvm/Support/CFGUpdate.h =================================================================== --- include/llvm/Support/CFGUpdate.h +++ include/llvm/Support/CFGUpdate.h @@ -105,7 +105,7 @@ Operations[{U.getTo(), U.getFrom()}] = int(i); } - llvm::sort(Result.begin(), Result.end(), + llvm::sort(Result, [&Operations](const Update &A, const Update &B) { return Operations[{A.getFrom(), A.getTo()}] > Operations[{B.getFrom(), B.getTo()}]; Index: include/llvm/Support/GenericDomTreeConstruction.h =================================================================== --- include/llvm/Support/GenericDomTreeConstruction.h +++ include/llvm/Support/GenericDomTreeConstruction.h @@ -1386,7 +1386,7 @@ // Make a copy and sort it such that it is possible to check if there are // no gaps between DFS numbers of adjacent children. SmallVector Children(Node->begin(), Node->end()); - llvm::sort(Children.begin(), Children.end(), + llvm::sort(Children, [](const TreeNodePtr Ch1, const TreeNodePtr Ch2) { return Ch1->getDFSNumIn() < Ch2->getDFSNumIn(); }); Index: include/llvm/Support/ScopedPrinter.h =================================================================== --- include/llvm/Support/ScopedPrinter.h +++ include/llvm/Support/ScopedPrinter.h @@ -138,7 +138,7 @@ } } - llvm::sort(SetFlags.begin(), SetFlags.end(), &flagName); + llvm::sort(SetFlags, &flagName); startLine() << Label << " [ (" << hex(Value) << ")\n"; for (const auto &Flag : SetFlags) { Index: lib/Analysis/BlockFrequencyInfoImpl.cpp =================================================================== --- lib/Analysis/BlockFrequencyInfoImpl.cpp +++ lib/Analysis/BlockFrequencyInfoImpl.cpp @@ -156,7 +156,7 @@ static void combineWeightsBySorting(WeightList &Weights) { // Sort so edges to the same node are adjacent. - llvm::sort(Weights.begin(), Weights.end(), + llvm::sort(Weights, [](const Weight &L, const Weight &R) { return L.TargetNode < R.TargetNode; }); @@ -707,7 +707,7 @@ "Expected irreducible CFG; -loop-info is likely invalid"); if (Headers.size() == InSCC.size()) { // Every block is a header. - llvm::sort(Headers.begin(), Headers.end()); + llvm::sort(Headers); return; } @@ -742,8 +742,8 @@ Others.push_back(Irr.Node); LLVM_DEBUG(dbgs() << " => other = " << BFI.getBlockName(Irr.Node) << "\n"); } - llvm::sort(Headers.begin(), Headers.end()); - llvm::sort(Others.begin(), Others.end()); + llvm::sort(Headers); + llvm::sort(Others); } static void createIrreducibleLoop( Index: lib/Analysis/CFLAndersAliasAnalysis.cpp =================================================================== --- lib/Analysis/CFLAndersAliasAnalysis.cpp +++ lib/Analysis/CFLAndersAliasAnalysis.cpp @@ -395,7 +395,7 @@ } // Sort AliasList for faster lookup - llvm::sort(AliasList.begin(), AliasList.end()); + llvm::sort(AliasList); } } @@ -479,7 +479,7 @@ } // Remove duplicates in ExtRelations - llvm::sort(ExtRelations.begin(), ExtRelations.end()); + llvm::sort(ExtRelations); ExtRelations.erase(std::unique(ExtRelations.begin(), ExtRelations.end()), ExtRelations.end()); } Index: lib/Analysis/CallGraph.cpp =================================================================== --- lib/Analysis/CallGraph.cpp +++ lib/Analysis/CallGraph.cpp @@ -97,7 +97,7 @@ for (const auto &I : *this) Nodes.push_back(I.second.get()); - llvm::sort(Nodes.begin(), Nodes.end(), + llvm::sort(Nodes, [](CallGraphNode *LHS, CallGraphNode *RHS) { if (Function *LF = LHS->getFunction()) if (Function *RF = RHS->getFunction()) Index: lib/Analysis/MemoryDependenceAnalysis.cpp =================================================================== --- lib/Analysis/MemoryDependenceAnalysis.cpp +++ lib/Analysis/MemoryDependenceAnalysis.cpp @@ -807,7 +807,7 @@ DirtyBlocks.push_back(Entry.getBB()); // Sort the cache so that we can do fast binary search lookups below. - llvm::sort(Cache.begin(), Cache.end()); + llvm::sort(Cache); ++NumCacheDirtyNonLocal; // cerr << "CACHED CASE: " << DirtyBlocks.size() << " dirty: " @@ -1070,7 +1070,7 @@ break; default: // Added many values, do a full scale sort. - llvm::sort(Cache.begin(), Cache.end()); + llvm::sort(Cache); break; } } @@ -1662,7 +1662,7 @@ // Re-sort the NonLocalDepInfo. Changing the dirty entry to its // subsequent value may invalidate the sortedness. - llvm::sort(NLPDI.begin(), NLPDI.end()); + llvm::sort(NLPDI); } ReverseNonLocalPtrDeps.erase(ReversePtrDepIt); Index: lib/Analysis/ScalarEvolution.cpp =================================================================== --- lib/Analysis/ScalarEvolution.cpp +++ lib/Analysis/ScalarEvolution.cpp @@ -11064,7 +11064,7 @@ Terms.erase(std::unique(Terms.begin(), Terms.end()), Terms.end()); // Put larger terms first. - llvm::sort(Terms.begin(), Terms.end(), [](const SCEV *LHS, const SCEV *RHS) { + llvm::sort(Terms, [](const SCEV *LHS, const SCEV *RHS) { return numberOfTerms(LHS) > numberOfTerms(RHS); }); Index: lib/Analysis/ScalarEvolutionExpander.cpp =================================================================== --- lib/Analysis/ScalarEvolutionExpander.cpp +++ lib/Analysis/ScalarEvolutionExpander.cpp @@ -1867,7 +1867,7 @@ Phis.push_back(&PN); if (TTI) - llvm::sort(Phis.begin(), Phis.end(), [](Value *LHS, Value *RHS) { + llvm::sort(Phis, [](Value *LHS, Value *RHS) { // Put pointers at the back and make sure pointer < pointer = false. if (!LHS->getType()->isIntegerTy() || !RHS->getType()->isIntegerTy()) return RHS->getType()->isIntegerTy() && !LHS->getType()->isIntegerTy(); Index: lib/Analysis/TargetLibraryInfo.cpp =================================================================== --- lib/Analysis/TargetLibraryInfo.cpp +++ lib/Analysis/TargetLibraryInfo.cpp @@ -1399,10 +1399,10 @@ void TargetLibraryInfoImpl::addVectorizableFunctions(ArrayRef Fns) { VectorDescs.insert(VectorDescs.end(), Fns.begin(), Fns.end()); - llvm::sort(VectorDescs.begin(), VectorDescs.end(), compareByScalarFnName); + llvm::sort(VectorDescs, compareByScalarFnName); ScalarDescs.insert(ScalarDescs.end(), Fns.begin(), Fns.end()); - llvm::sort(ScalarDescs.begin(), ScalarDescs.end(), compareByVectorFnName); + llvm::sort(ScalarDescs, compareByVectorFnName); } void TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib( Index: lib/Bitcode/Reader/ValueList.cpp =================================================================== --- lib/Bitcode/Reader/ValueList.cpp +++ lib/Bitcode/Reader/ValueList.cpp @@ -144,7 +144,7 @@ void BitcodeReaderValueList::resolveConstantForwardRefs() { // Sort the values by-pointer so that they are efficient to look up with a // binary search. - llvm::sort(ResolveConstants.begin(), ResolveConstants.end()); + llvm::sort(ResolveConstants); SmallVector NewOps; Index: lib/Bitcode/Writer/ValueEnumerator.cpp =================================================================== --- lib/Bitcode/Writer/ValueEnumerator.cpp +++ lib/Bitcode/Writer/ValueEnumerator.cpp @@ -184,7 +184,7 @@ return; bool IsGlobalValue = OM.isGlobalValue(ID); - llvm::sort(List.begin(), List.end(), [&](const Entry &L, const Entry &R) { + llvm::sort(List, [&](const Entry &L, const Entry &R) { const Use *LU = L.first; const Use *RU = R.first; if (LU == RU) @@ -745,7 +745,7 @@ // and then sort by the original/current ID. Since the IDs are guaranteed to // be unique, the result of std::sort will be deterministic. There's no need // for std::stable_sort. - llvm::sort(Order.begin(), Order.end(), [this](MDIndex LHS, MDIndex RHS) { + llvm::sort(Order, [this](MDIndex LHS, MDIndex RHS) { return std::make_tuple(LHS.F, getMetadataTypeOrder(LHS.get(MDs)), LHS.ID) < std::make_tuple(RHS.F, getMetadataTypeOrder(RHS.get(MDs)), RHS.ID); }); Index: lib/CodeGen/AsmPrinter/CodeViewDebug.cpp =================================================================== --- lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -2353,7 +2353,7 @@ for (const LocalVariable &L : Locals) if (L.DIVar->isParameter()) Params.push_back(&L); - llvm::sort(Params.begin(), Params.end(), + llvm::sort(Params, [](const LocalVariable *L, const LocalVariable *R) { return L->DIVar->getArg() < R->DIVar->getArg(); }); Index: lib/CodeGen/AsmPrinter/DebugLocEntry.h =================================================================== --- lib/CodeGen/AsmPrinter/DebugLocEntry.h +++ lib/CodeGen/AsmPrinter/DebugLocEntry.h @@ -139,7 +139,7 @@ // Sort the pieces by offset. // Remove any duplicate entries by dropping all but the first. void sortUniqueValues() { - llvm::sort(Values.begin(), Values.end()); + llvm::sort(Values); Values.erase( std::unique( Values.begin(), Values.end(), [](const Value &A, const Value &B) { Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp =================================================================== --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -241,7 +241,7 @@ return A.Expr->isFragment(); }) && "multiple FI expressions without DW_OP_LLVM_fragment"); - llvm::sort(FrameIndexExprs.begin(), FrameIndexExprs.end(), + llvm::sort(FrameIndexExprs, [](const FrameIndexExpr &A, const FrameIndexExpr &B) -> bool { return A.Expr->getFragmentInfo()->OffsetInBits < B.Expr->getFragmentInfo()->OffsetInBits; @@ -612,7 +612,7 @@ /// Sort and unique GVEs by comparing their fragment offset. static SmallVectorImpl & sortGlobalExprs(SmallVectorImpl &GVEs) { - llvm::sort(GVEs.begin(), GVEs.end(), + llvm::sort(GVEs, [](DwarfCompileUnit::GlobalExpr A, DwarfCompileUnit::GlobalExpr B) { // Sort order: first null exprs, then exprs without fragment @@ -2000,7 +2000,7 @@ } // Sort the CU list (again, to ensure consistent output order). - llvm::sort(CUs.begin(), CUs.end(), + llvm::sort(CUs, [](const DwarfCompileUnit *A, const DwarfCompileUnit *B) { return A->getUniqueID() < B->getUniqueID(); }); Index: lib/CodeGen/AsmPrinter/EHStreamer.cpp =================================================================== --- lib/CodeGen/AsmPrinter/EHStreamer.cpp +++ lib/CodeGen/AsmPrinter/EHStreamer.cpp @@ -359,7 +359,7 @@ LandingPads.push_back(&PadInfos[i]); // Order landing pads lexicographically by type id. - llvm::sort(LandingPads.begin(), LandingPads.end(), + llvm::sort(LandingPads, [](const LandingPadInfo *L, const LandingPadInfo *R) { return L->TypeIds < R->TypeIds; }); Index: lib/CodeGen/CodeGenPrepare.cpp =================================================================== --- lib/CodeGen/CodeGenPrepare.cpp +++ lib/CodeGen/CodeGenPrepare.cpp @@ -4989,7 +4989,7 @@ return LargeOffsetGEPID[LHS.first] < LargeOffsetGEPID[RHS.first]; }; // Sorting all the GEPs of the same data structures based on the offsets. - llvm::sort(LargeOffsetGEPs.begin(), LargeOffsetGEPs.end(), + llvm::sort(LargeOffsetGEPs, compareGEPOffset); LargeOffsetGEPs.erase( std::unique(LargeOffsetGEPs.begin(), LargeOffsetGEPs.end()), Index: lib/CodeGen/GlobalISel/LegalizerInfo.cpp =================================================================== --- lib/CodeGen/GlobalISel/LegalizerInfo.cpp +++ lib/CodeGen/GlobalISel/LegalizerInfo.cpp @@ -219,7 +219,7 @@ Opcode, TypeIdx, ElementSize, moreToWiderTypesAndLessToWidest(NumElementsActions)); } - llvm::sort(ElementSizesSeen.begin(), ElementSizesSeen.end()); + llvm::sort(ElementSizesSeen); SizeChangeStrategy VectorElementSizeChangeStrategy = &unsupportedForDifferentSizes; if (TypeIdx < VectorElementSizeChangeStrategies[OpcodeIdx].size() && Index: lib/CodeGen/LocalStackSlotAllocation.cpp =================================================================== --- lib/CodeGen/LocalStackSlotAllocation.cpp +++ lib/CodeGen/LocalStackSlotAllocation.cpp @@ -328,7 +328,7 @@ // Sort the frame references by local offset. // Use frame index as a tie-breaker in case MI's have the same offset. - llvm::sort(FrameReferenceInsns.begin(), FrameReferenceInsns.end()); + llvm::sort(FrameReferenceInsns); MachineBasicBlock *Entry = &Fn.front(); Index: lib/CodeGen/MIRCanonicalizerPass.cpp =================================================================== --- lib/CodeGen/MIRCanonicalizerPass.cpp +++ lib/CodeGen/MIRCanonicalizerPass.cpp @@ -134,7 +134,7 @@ StringInstrMap.push_back({(i == std::string::npos) ? S : S.substr(i), II}); } - llvm::sort(StringInstrMap.begin(), StringInstrMap.end(), + llvm::sort(StringInstrMap, [](const StringInstrPair &a, const StringInstrPair &b) -> bool { return (a.first < b.first); }); Index: lib/CodeGen/MachineBasicBlock.cpp =================================================================== --- lib/CodeGen/MachineBasicBlock.cpp +++ lib/CodeGen/MachineBasicBlock.cpp @@ -461,7 +461,7 @@ } void MachineBasicBlock::sortUniqueLiveIns() { - llvm::sort(LiveIns.begin(), LiveIns.end(), + llvm::sort(LiveIns, [](const RegisterMaskPair &LI0, const RegisterMaskPair &LI1) { return LI0.PhysReg < LI1.PhysReg; }); Index: lib/CodeGen/MachinePipeliner.cpp =================================================================== --- lib/CodeGen/MachinePipeliner.cpp +++ lib/CodeGen/MachinePipeliner.cpp @@ -1861,7 +1861,7 @@ RecRPTracker.closeBottom(); std::vector SUnits(NS.begin(), NS.end()); - llvm::sort(SUnits.begin(), SUnits.end(), + llvm::sort(SUnits, [](const SUnit *A, const SUnit *B) { return A->NodeNum > B->NodeNum; }); @@ -3981,7 +3981,7 @@ }; // sort, so that we can perform a binary search - llvm::sort(Indices.begin(), Indices.end(), CompareKey); + llvm::sort(Indices, CompareKey); bool Valid = true; (void)Valid; Index: lib/CodeGen/MachineScheduler.cpp =================================================================== --- lib/CodeGen/MachineScheduler.cpp +++ lib/CodeGen/MachineScheduler.cpp @@ -1554,7 +1554,7 @@ if (MemOpRecords.size() < 2) return; - llvm::sort(MemOpRecords.begin(), MemOpRecords.end()); + llvm::sort(MemOpRecords); unsigned ClusterLength = 1; for (unsigned Idx = 0, End = MemOpRecords.size(); Idx < (End - 1); ++Idx) { SUnit *SUa = MemOpRecords[Idx].SU; Index: lib/CodeGen/ReachingDefAnalysis.cpp =================================================================== --- lib/CodeGen/ReachingDefAnalysis.cpp +++ lib/CodeGen/ReachingDefAnalysis.cpp @@ -157,7 +157,7 @@ // Sorting all reaching defs found for a ceartin reg unit in a given BB. for (MBBDefsInfo &MBBDefs : MBBReachingDefs) { for (MBBRegUnitDefs &RegUnitDefs : MBBDefs) - llvm::sort(RegUnitDefs.begin(), RegUnitDefs.end()); + llvm::sort(RegUnitDefs); } return false; Index: lib/CodeGen/ScheduleDAGInstrs.cpp =================================================================== --- lib/CodeGen/ScheduleDAGInstrs.cpp +++ lib/CodeGen/ScheduleDAGInstrs.cpp @@ -996,7 +996,7 @@ for (auto &I : loads) for (auto *SU : I.second) NodeNums.push_back(SU->NodeNum); - llvm::sort(NodeNums.begin(), NodeNums.end()); + llvm::sort(NodeNums); // The N last elements in NodeNums will be removed, and the SU with // the lowest NodeNum of them will become the new BarrierChain to Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp =================================================================== --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -13250,7 +13250,7 @@ // Sort the slices so that elements that are likely to be next to each // other in memory are next to each other in the list. - llvm::sort(LoadedSlices.begin(), LoadedSlices.end(), + llvm::sort(LoadedSlices, [](const LoadedSlice &LHS, const LoadedSlice &RHS) { assert(LHS.Origin == RHS.Origin && "Different bases not implemented."); return LHS.getOffsetFromBase() < RHS.getOffsetFromBase(); @@ -14247,7 +14247,7 @@ // Sort the memory operands according to their distance from the // base pointer. - llvm::sort(StoreNodes.begin(), StoreNodes.end(), + llvm::sort(StoreNodes, [](MemOpLink LHS, MemOpLink RHS) { return LHS.OffsetFromBase < RHS.OffsetFromBase; }); Index: lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp =================================================================== --- lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp +++ lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp @@ -242,7 +242,7 @@ return; // Sort them in increasing order. - llvm::sort(Offsets.begin(), Offsets.end()); + llvm::sort(Offsets); // Check if the loads are close enough. SmallVector Loads; Index: lib/CodeGen/SelectionDAG/SelectionDAG.cpp =================================================================== --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -8016,7 +8016,7 @@ } // Sort the uses, so that all the uses from a given User are together. - llvm::sort(Uses.begin(), Uses.end()); + llvm::sort(Uses); for (unsigned UseIndex = 0, UseIndexEnd = Uses.size(); UseIndex != UseIndexEnd; ) { Index: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp =================================================================== --- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -2580,7 +2580,7 @@ assert(CC.Low == CC.High && "Input clusters must be single-case"); #endif - llvm::sort(Clusters.begin(), Clusters.end(), + llvm::sort(Clusters, [](const CaseCluster &a, const CaseCluster &b) { return a.Low->getValue().slt(b.Low->getValue()); }); @@ -6252,7 +6252,7 @@ GA->getGlobal(), getCurSDLoc(), Val.getValueType(), GA->getOffset())}); } - llvm::sort(Targets.begin(), Targets.end(), + llvm::sort(Targets, [](const BranchFunnelTarget &T1, const BranchFunnelTarget &T2) { return T1.Offset < T2.Offset; }); @@ -9670,7 +9670,7 @@ } BitTestInfo BTI; - llvm::sort(CBV.begin(), CBV.end(), [](const CaseBits &a, const CaseBits &b) { + llvm::sort(CBV, [](const CaseBits &a, const CaseBits &b) { // Sort by probability first, number of bits second, bit mask third. if (a.ExtraProb != b.ExtraProb) return a.ExtraProb > b.ExtraProb; Index: lib/CodeGen/SlotIndexes.cpp =================================================================== --- lib/CodeGen/SlotIndexes.cpp +++ lib/CodeGen/SlotIndexes.cpp @@ -95,7 +95,7 @@ } // Sort the Idx2MBBMap - llvm::sort(idx2MBBMap.begin(), idx2MBBMap.end(), Idx2MBBCompare()); + llvm::sort(idx2MBBMap, Idx2MBBCompare()); LLVM_DEBUG(mf->print(dbgs(), this)); Index: lib/CodeGen/StackColoring.cpp =================================================================== --- lib/CodeGen/StackColoring.cpp +++ lib/CodeGen/StackColoring.cpp @@ -1231,7 +1231,7 @@ }); for (auto &s : LiveStarts) - llvm::sort(s.begin(), s.end()); + llvm::sort(s); bool Changed = true; while (Changed) { Index: lib/CodeGen/StackMaps.cpp =================================================================== --- lib/CodeGen/StackMaps.cpp +++ lib/CodeGen/StackMaps.cpp @@ -268,7 +268,7 @@ // in the list. Merge entries that refer to the same dwarf register and use // the maximum size that needs to be spilled. - llvm::sort(LiveOuts.begin(), LiveOuts.end(), + llvm::sort(LiveOuts, [](const LiveOutReg &LHS, const LiveOutReg &RHS) { // Only sort by the dwarf register number. return LHS.DwarfRegNum < RHS.DwarfRegNum; Index: lib/CodeGen/StackSlotColoring.cpp =================================================================== --- lib/CodeGen/StackSlotColoring.cpp +++ lib/CodeGen/StackSlotColoring.cpp @@ -214,7 +214,7 @@ Intervals.reserve(LS->getNumIntervals()); for (auto &I : *LS) Intervals.push_back(&I); - llvm::sort(Intervals.begin(), Intervals.end(), + llvm::sort(Intervals, [](Pair *LHS, Pair *RHS) { return LHS->first < RHS->first; }); // Gather all spill slots into a list. Index: lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp =================================================================== --- lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp +++ lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp @@ -79,7 +79,7 @@ for (const auto &M : Mappings) Ids.push_back(&M); - llvm::sort(Ids.begin(), Ids.end(), [this](const T &L1, const T &L2) { + llvm::sort(Ids, [this](const T &L1, const T &L2) { return Strings.getIdForString(L1->getKey()) < Strings.getIdForString(L2->getKey()); }); Index: lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp =================================================================== --- lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp +++ lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp @@ -91,7 +91,7 @@ Result.reserve(IdToString.size()); for (const auto &Entry : IdToString) Result.push_back(Entry.first); - llvm::sort(Result.begin(), Result.end()); + llvm::sort(Result); return Result; } Index: lib/DebugInfo/DWARF/DWARFContext.cpp =================================================================== --- lib/DebugInfo/DWARF/DWARFContext.cpp +++ lib/DebugInfo/DWARF/DWARFContext.cpp @@ -106,7 +106,7 @@ // Sort the contributions so that any invalid ones are placed at // the start of the contributions vector. This way they are reported // first. - llvm::sort(Contributions.begin(), Contributions.end(), + llvm::sort(Contributions, [](const Optional &L, const Optional &R) { if (L && R) return L->Base < R->Base; Index: lib/DebugInfo/DWARF/DWARFDebugAranges.cpp =================================================================== --- lib/DebugInfo/DWARF/DWARFDebugAranges.cpp +++ lib/DebugInfo/DWARF/DWARFDebugAranges.cpp @@ -80,7 +80,7 @@ void DWARFDebugAranges::construct() { std::multiset ValidCUs; // Maintain the set of CUs describing // a current address range. - llvm::sort(Endpoints.begin(), Endpoints.end()); + llvm::sort(Endpoints); uint64_t PrevAddress = -1ULL; for (const auto &E : Endpoints) { if (PrevAddress < E.Address && !ValidCUs.empty()) { Index: lib/DebugInfo/DWARF/DWARFDebugLine.cpp =================================================================== --- lib/DebugInfo/DWARF/DWARFDebugLine.cpp +++ lib/DebugInfo/DWARF/DWARFDebugLine.cpp @@ -839,7 +839,7 @@ // Sort all sequences so that address lookup will work faster. if (!Sequences.empty()) { - llvm::sort(Sequences.begin(), Sequences.end(), Sequence::orderByLowPC); + llvm::sort(Sequences, Sequence::orderByLowPC); // Note: actually, instruction address ranges of sequences should not // overlap (in shared objects and executables). If they do, the address // lookup would still work, though, but result would be ambiguous. Index: lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp =================================================================== --- lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp +++ lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp @@ -144,7 +144,7 @@ // can properly early-out when it detects the record won't be found. The // algorithm used here corredsponds to the function // caseInsensitiveComparePchPchCchCch in the reference implementation. - llvm::sort(Bucket.begin(), Bucket.end(), + llvm::sort(Bucket, [](const std::pair &Left, const std::pair &Right) { return gsiRecordLess(Left.first, Right.first); Index: lib/IR/AsmWriter.cpp =================================================================== --- lib/IR/AsmWriter.cpp +++ lib/IR/AsmWriter.cpp @@ -199,7 +199,7 @@ !isa(V) && !isa(V) && !isa(V); if (auto *BA = dyn_cast(V)) ID = OM.lookup(BA->getBasicBlock()).first; - llvm::sort(List.begin(), List.end(), [&](const Entry &L, const Entry &R) { + llvm::sort(List, [&](const Entry &L, const Entry &R) { const Use *LU = L.first; const Use *RU = R.first; if (LU == RU) Index: lib/IR/Attributes.cpp =================================================================== --- lib/IR/Attributes.cpp +++ lib/IR/Attributes.cpp @@ -658,7 +658,7 @@ FoldingSetNodeID ID; SmallVector SortedAttrs(Attrs.begin(), Attrs.end()); - llvm::sort(SortedAttrs.begin(), SortedAttrs.end()); + llvm::sort(SortedAttrs); for (const auto Attr : SortedAttrs) Attr.Profile(ID); Index: lib/IR/Metadata.cpp =================================================================== --- lib/IR/Metadata.cpp +++ lib/IR/Metadata.cpp @@ -237,7 +237,7 @@ // Copy out uses since UseMap will get touched below. using UseTy = std::pair>; SmallVector Uses(UseMap.begin(), UseMap.end()); - llvm::sort(Uses.begin(), Uses.end(), [](const UseTy &L, const UseTy &R) { + llvm::sort(Uses, [](const UseTy &L, const UseTy &R) { return L.second.second < R.second.second; }); for (const auto &Pair : Uses) { @@ -290,7 +290,7 @@ // Copy out uses since UseMap could get touched below. using UseTy = std::pair>; SmallVector Uses(UseMap.begin(), UseMap.end()); - llvm::sort(Uses.begin(), Uses.end(), [](const UseTy &L, const UseTy &R) { + llvm::sort(Uses, [](const UseTy &L, const UseTy &R) { return L.second.second < R.second.second; }); UseMap.clear(); Index: lib/IR/Verifier.cpp =================================================================== --- lib/IR/Verifier.cpp +++ lib/IR/Verifier.cpp @@ -2300,7 +2300,7 @@ if (isa(BB.front())) { SmallVector Preds(pred_begin(&BB), pred_end(&BB)); SmallVector, 8> Values; - llvm::sort(Preds.begin(), Preds.end()); + llvm::sort(Preds); for (const PHINode &PN : BB.phis()) { // Ensure that PHI nodes have at least one entry! Assert(PN.getNumIncomingValues() != 0, @@ -2318,7 +2318,7 @@ for (unsigned i = 0, e = PN.getNumIncomingValues(); i != e; ++i) Values.push_back( std::make_pair(PN.getIncomingBlock(i), PN.getIncomingValue(i))); - llvm::sort(Values.begin(), Values.end()); + llvm::sort(Values); for (unsigned i = 0, e = Values.size(); i != e; ++i) { // Check to make sure that if there is more than one entry for a Index: lib/LTO/ThinLTOCodeGenerator.cpp =================================================================== --- lib/LTO/ThinLTOCodeGenerator.cpp +++ lib/LTO/ThinLTOCodeGenerator.cpp @@ -968,7 +968,7 @@ std::vector ModulesOrdering; ModulesOrdering.resize(Modules.size()); std::iota(ModulesOrdering.begin(), ModulesOrdering.end(), 0); - llvm::sort(ModulesOrdering.begin(), ModulesOrdering.end(), + llvm::sort(ModulesOrdering, [&](int LeftIndex, int RightIndex) { auto LSize = Modules[LeftIndex].getBuffer().size(); auto RSize = Modules[RightIndex].getBuffer().size(); Index: lib/MC/MachObjectWriter.cpp =================================================================== --- lib/MC/MachObjectWriter.cpp +++ lib/MC/MachObjectWriter.cpp @@ -597,8 +597,8 @@ } // External and undefined symbols are required to be in lexicographic order. - llvm::sort(ExternalSymbolData.begin(), ExternalSymbolData.end()); - llvm::sort(UndefinedSymbolData.begin(), UndefinedSymbolData.end()); + llvm::sort(ExternalSymbolData); + llvm::sort(UndefinedSymbolData); // Set the symbol indices. Index = 0; Index: lib/MC/WinCOFFObjectWriter.cpp =================================================================== --- lib/MC/WinCOFFObjectWriter.cpp +++ lib/MC/WinCOFFObjectWriter.cpp @@ -558,7 +558,7 @@ std::vector Arr; for (auto &Section : Sections) Arr.push_back(Section.get()); - llvm::sort(Arr.begin(), Arr.end(), + llvm::sort(Arr, [](const COFFSection *A, const COFFSection *B) { return A->Number < B->Number; }); Index: lib/ProfileData/Coverage/CoverageMapping.cpp =================================================================== --- lib/ProfileData/Coverage/CoverageMapping.cpp +++ lib/ProfileData/Coverage/CoverageMapping.cpp @@ -83,7 +83,7 @@ return Counter::getZero(); // Group the terms by counter ID. - llvm::sort(Terms.begin(), Terms.end(), [](const Term &LHS, const Term &RHS) { + llvm::sort(Terms, [](const Term &LHS, const Term &RHS) { return LHS.CounterID < RHS.CounterID; }); @@ -463,7 +463,7 @@ /// Sort a nested sequence of regions from a single file. static void sortNestedRegions(MutableArrayRef Regions) { - llvm::sort(Regions.begin(), Regions.end(), [](const CountedRegion &LHS, + llvm::sort(Regions, [](const CountedRegion &LHS, const CountedRegion &RHS) { if (LHS.startLoc() != RHS.startLoc()) return LHS.startLoc() < RHS.startLoc(); @@ -561,7 +561,7 @@ for (const auto &Function : getCoveredFunctions()) Filenames.insert(Filenames.end(), Function.Filenames.begin(), Function.Filenames.end()); - llvm::sort(Filenames.begin(), Filenames.end()); + llvm::sort(Filenames); auto Last = std::unique(Filenames.begin(), Filenames.end()); Filenames.erase(Last, Filenames.end()); return Filenames; Index: lib/ProfileData/GCOV.cpp =================================================================== --- lib/ProfileData/GCOV.cpp +++ lib/ProfileData/GCOV.cpp @@ -712,7 +712,7 @@ SmallVector Filenames; for (const auto &LI : LineInfo) Filenames.push_back(LI.first()); - llvm::sort(Filenames.begin(), Filenames.end()); + llvm::sort(Filenames); for (StringRef Filename : Filenames) { auto AllLines = LineConsumer(Filename); Index: lib/ProfileData/ProfileSummaryBuilder.cpp =================================================================== --- lib/ProfileData/ProfileSummaryBuilder.cpp +++ lib/ProfileData/ProfileSummaryBuilder.cpp @@ -58,7 +58,7 @@ void ProfileSummaryBuilder::computeDetailedSummary() { if (DetailedSummaryCutoffs.empty()) return; - llvm::sort(DetailedSummaryCutoffs.begin(), DetailedSummaryCutoffs.end()); + llvm::sort(DetailedSummaryCutoffs); auto Iter = CountFrequencies.begin(); const auto End = CountFrequencies.end(); Index: lib/Support/JSON.cpp =================================================================== --- lib/Support/JSON.cpp +++ lib/Support/JSON.cpp @@ -517,7 +517,7 @@ std::vector Elements; for (const auto &E : O) Elements.push_back(&E); - llvm::sort(Elements.begin(), Elements.end(), + llvm::sort(Elements, [](const Object::value_type *L, const Object::value_type *R) { return L->first < R->first; }); Index: lib/Support/SourceMgr.cpp =================================================================== --- lib/Support/SourceMgr.cpp +++ lib/Support/SourceMgr.cpp @@ -269,7 +269,7 @@ : SM(&sm), Loc(L), Filename(FN), LineNo(Line), ColumnNo(Col), Kind(Kind), Message(Msg), LineContents(LineStr), Ranges(Ranges.vec()), FixIts(Hints.begin(), Hints.end()) { - llvm::sort(FixIts.begin(), FixIts.end()); + llvm::sort(FixIts); } static void buildFixItLine(std::string &CaretLine, std::string &FixItLine, Index: lib/Support/Timer.cpp =================================================================== --- lib/Support/Timer.cpp +++ lib/Support/Timer.cpp @@ -295,7 +295,7 @@ void TimerGroup::PrintQueuedTimers(raw_ostream &OS) { // Sort the timers in descending order by amount of time taken. - llvm::sort(TimersToPrint.begin(), TimersToPrint.end()); + llvm::sort(TimersToPrint); TimeRecord Total; for (const PrintRecord &Record : TimersToPrint) Index: lib/TableGen/Record.cpp =================================================================== --- lib/TableGen/Record.cpp +++ lib/TableGen/Record.cpp @@ -158,7 +158,7 @@ SmallVector Classes(UnsortedClasses.begin(), UnsortedClasses.end()); - llvm::sort(Classes.begin(), Classes.end(), + llvm::sort(Classes, [](Record *LHS, Record *RHS) { return LHS->getNameInitAsString() < RHS->getNameInitAsString(); }); Index: lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp =================================================================== --- lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp +++ lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp @@ -377,7 +377,7 @@ // Now we have a set of sets, order them by start address so // we can iterate over them sequentially. - llvm::sort(V.begin(), V.end(), + llvm::sort(V, [](const std::vector &A, const std::vector &B) { return A.front()->startsBefore(B.front()); @@ -453,7 +453,7 @@ // change them to! // Final tie-break with instruction order so pass output is stable (i.e. not // dependent on malloc'd pointer values). - llvm::sort(GV.begin(), GV.end(), [](const Chain *G1, const Chain *G2) { + llvm::sort(GV, [](const Chain *G1, const Chain *G2) { if (G1->size() != G2->size()) return G1->size() > G2->size(); if (G1->requiresFixup() != G2->requiresFixup()) Index: lib/Target/AMDGPU/GCNIterativeScheduler.cpp =================================================================== --- lib/Target/AMDGPU/GCNIterativeScheduler.cpp +++ lib/Target/AMDGPU/GCNIterativeScheduler.cpp @@ -434,7 +434,7 @@ // Sort recorded regions by pressure - highest at the front void GCNIterativeScheduler::sortRegionsByPressure(unsigned TargetOcc) { const auto &ST = MF.getSubtarget(); - llvm::sort(Regions.begin(), Regions.end(), + llvm::sort(Regions, [&ST, TargetOcc](const Region *R1, const Region *R2) { return R2->MaxPressure.less(ST, R1->MaxPressure, TargetOcc); }); Index: lib/Target/AMDGPU/SIFormMemoryClauses.cpp =================================================================== --- lib/Target/AMDGPU/SIFormMemoryClauses.cpp +++ lib/Target/AMDGPU/SIFormMemoryClauses.cpp @@ -168,7 +168,7 @@ CoveringSubregs.push_back(Idx); } - llvm::sort(CoveringSubregs.begin(), CoveringSubregs.end(), + llvm::sort(CoveringSubregs, [this](unsigned A, unsigned B) { LaneBitmask MaskA = TRI->getSubRegIndexLaneMask(A); LaneBitmask MaskB = TRI->getSubRegIndexLaneMask(B); Index: lib/Target/ARM/ARMBaseInstrInfo.cpp =================================================================== --- lib/Target/ARM/ARMBaseInstrInfo.cpp +++ lib/Target/ARM/ARMBaseInstrInfo.cpp @@ -1444,7 +1444,7 @@ SmallVector ScratchRegs; for(unsigned I = 5; I < MI->getNumOperands(); ++I) ScratchRegs.push_back(MI->getOperand(I).getReg()); - llvm::sort(ScratchRegs.begin(), ScratchRegs.end(), + llvm::sort(ScratchRegs, [&TRI](const unsigned &Reg1, const unsigned &Reg2) -> bool { return TRI.getEncodingValue(Reg1) < Index: lib/Target/ARM/ARMFrameLowering.cpp =================================================================== --- lib/Target/ARM/ARMFrameLowering.cpp +++ lib/Target/ARM/ARMFrameLowering.cpp @@ -1008,7 +1008,7 @@ if (Regs.empty()) continue; - llvm::sort(Regs.begin(), Regs.end(), [&](const RegAndKill &LHS, + llvm::sort(Regs, [&](const RegAndKill &LHS, const RegAndKill &RHS) { return TRI.getEncodingValue(LHS.first) < TRI.getEncodingValue(RHS.first); }); @@ -1105,7 +1105,7 @@ if (Regs.empty()) continue; - llvm::sort(Regs.begin(), Regs.end(), [&](unsigned LHS, unsigned RHS) { + llvm::sort(Regs, [&](unsigned LHS, unsigned RHS) { return TRI.getEncodingValue(LHS) < TRI.getEncodingValue(RHS); }); Index: lib/Target/ARM/ARMLoadStoreOptimizer.cpp =================================================================== --- lib/Target/ARM/ARMLoadStoreOptimizer.cpp +++ lib/Target/ARM/ARMLoadStoreOptimizer.cpp @@ -1848,7 +1848,7 @@ auto LessThan = [](const MergeCandidate* M0, const MergeCandidate *M1) { return M0->InsertPos < M1->InsertPos; }; - llvm::sort(Candidates.begin(), Candidates.end(), LessThan); + llvm::sort(Candidates, LessThan); // Go through list of candidates and merge. bool Changed = false; @@ -2186,7 +2186,7 @@ bool RetVal = false; // Sort by offset (in reverse order). - llvm::sort(Ops.begin(), Ops.end(), + llvm::sort(Ops, [](const MachineInstr *LHS, const MachineInstr *RHS) { int LOffset = getMemoryOpOffset(*LHS); int ROffset = getMemoryOpOffset(*RHS); Index: lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp =================================================================== --- lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp +++ lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp @@ -1072,7 +1072,7 @@ if (Contents.empty()) return; - llvm::sort(Contents.begin(), Contents.end(), AttributeItem::LessTag); + llvm::sort(Contents, AttributeItem::LessTag); ARMELFStreamer &Streamer = getStreamer(); Index: lib/Target/Hexagon/HexagonConstExtenders.cpp =================================================================== --- lib/Target/Hexagon/HexagonConstExtenders.cpp +++ lib/Target/Hexagon/HexagonConstExtenders.cpp @@ -1947,7 +1947,7 @@ AssignmentMap IMap; collect(MF); - llvm::sort(Extenders.begin(), Extenders.end(), + llvm::sort(Extenders, [](const ExtDesc &A, const ExtDesc &B) { return ExtValue(A) < ExtValue(B); }); Index: lib/Target/Hexagon/HexagonGenInsert.cpp =================================================================== --- lib/Target/Hexagon/HexagonGenInsert.cpp +++ lib/Target/Hexagon/HexagonGenInsert.cpp @@ -632,7 +632,7 @@ SortableVectorType VRs; for (RegisterOrdering::iterator I = RB.begin(), E = RB.end(); I != E; ++I) VRs.push_back(I->first); - llvm::sort(VRs.begin(), VRs.end(), LexCmp); + llvm::sort(VRs, LexCmp); // Transfer the results to the outgoing register ordering. for (unsigned i = 0, n = VRs.size(); i < n; ++i) RO.insert(std::make_pair(VRs[i], i)); Index: lib/Target/Hexagon/HexagonStoreWidening.cpp =================================================================== --- lib/Target/Hexagon/HexagonStoreWidening.cpp +++ lib/Target/Hexagon/HexagonStoreWidening.cpp @@ -578,7 +578,7 @@ }; for (auto &G : SGs) { assert(G.size() > 1 && "Store group with fewer than 2 elements"); - llvm::sort(G.begin(), G.end(), Less); + llvm::sort(G, Less); Changed |= processStoreGroup(G); } Index: lib/Target/Hexagon/RDFDeadCode.cpp =================================================================== --- lib/Target/Hexagon/RDFDeadCode.cpp +++ lib/Target/Hexagon/RDFDeadCode.cpp @@ -214,7 +214,7 @@ return false; return A.Id < B.Id; }; - llvm::sort(DRNs.begin(), DRNs.end(), UsesFirst); + llvm::sort(DRNs, UsesFirst); if (trace()) dbgs() << "Removing dead ref nodes:\n"; Index: lib/Target/Hexagon/RDFGraph.cpp =================================================================== --- lib/Target/Hexagon/RDFGraph.cpp +++ lib/Target/Hexagon/RDFGraph.cpp @@ -1471,7 +1471,7 @@ // and add a def for each S in the closure. // Sort the refs so that the phis will be created in a deterministic order. - llvm::sort(MaxRefs.begin(), MaxRefs.end()); + llvm::sort(MaxRefs); // Remove duplicates. auto NewEnd = std::unique(MaxRefs.begin(), MaxRefs.end()); MaxRefs.erase(NewEnd, MaxRefs.end()); Index: lib/Target/Hexagon/RDFLiveness.cpp =================================================================== --- lib/Target/Hexagon/RDFLiveness.cpp +++ lib/Target/Hexagon/RDFLiveness.cpp @@ -207,7 +207,7 @@ }; std::vector Tmp(Owners.begin(), Owners.end()); - llvm::sort(Tmp.begin(), Tmp.end(), Less); + llvm::sort(Tmp, Less); // The vector is a list of instructions, so that defs coming from // the same instruction don't need to be artificially ordered. @@ -813,7 +813,7 @@ std::vector LV; for (auto I = B.livein_begin(), E = B.livein_end(); I != E; ++I) LV.push_back(RegisterRef(I->PhysReg, I->LaneMask)); - llvm::sort(LV.begin(), LV.end()); + llvm::sort(LV); dbgs() << printMBBReference(B) << "\t rec = {"; for (auto I : LV) dbgs() << ' ' << Print(I, DFG); @@ -824,7 +824,7 @@ const RegisterAggr &LG = LiveMap[&B]; for (auto I = LG.rr_begin(), E = LG.rr_end(); I != E; ++I) LV.push_back(*I); - llvm::sort(LV.begin(), LV.end()); + llvm::sort(LV); dbgs() << "\tcomp = {"; for (auto I : LV) dbgs() << ' ' << Print(I, DFG); Index: lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp =================================================================== --- lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp +++ lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp @@ -453,7 +453,7 @@ return; // Sort relocations by the address they are applied to. - llvm::sort(Relocs.begin(), Relocs.end(), + llvm::sort(Relocs, [](const ELFRelocationEntry &A, const ELFRelocationEntry &B) { return A.Offset < B.Offset; }); Index: lib/Target/PowerPC/PPCISelDAGToDAG.cpp =================================================================== --- lib/Target/PowerPC/PPCISelDAGToDAG.cpp +++ lib/Target/PowerPC/PPCISelDAGToDAG.cpp @@ -1401,7 +1401,7 @@ for (auto &I : ValueRots) { ValueRotsVec.push_back(I.second); } - llvm::sort(ValueRotsVec.begin(), ValueRotsVec.end()); + llvm::sort(ValueRotsVec); } // In 64-bit mode, rlwinm and friends have a rotation operator that Index: lib/Target/WebAssembly/WebAssemblyRegColoring.cpp =================================================================== --- lib/Target/WebAssembly/WebAssemblyRegColoring.cpp +++ lib/Target/WebAssembly/WebAssemblyRegColoring.cpp @@ -118,7 +118,7 @@ // registers), by weight next, and then by position. // TODO: Investigate more intelligent sorting heuristics. For starters, we // should try to coalesce adjacent live intervals before non-adjacent ones. - llvm::sort(SortedIntervals.begin(), SortedIntervals.end(), + llvm::sort(SortedIntervals, [MRI](LiveInterval *LHS, LiveInterval *RHS) { if (MRI->isLiveIn(LHS->reg) != MRI->isLiveIn(RHS->reg)) return MRI->isLiveIn(LHS->reg); Index: lib/Target/X86/X86SpeculativeLoadHardening.cpp =================================================================== --- lib/Target/X86/X86SpeculativeLoadHardening.cpp +++ lib/Target/X86/X86SpeculativeLoadHardening.cpp @@ -828,7 +828,7 @@ "split above!"); // Sort and unique the codes to minimize them. - llvm::sort(UncondCodeSeq.begin(), UncondCodeSeq.end()); + llvm::sort(UncondCodeSeq); UncondCodeSeq.erase(std::unique(UncondCodeSeq.begin(), UncondCodeSeq.end()), UncondCodeSeq.end()); Index: lib/Target/XCore/XCoreFrameLowering.cpp =================================================================== --- lib/Target/XCore/XCoreFrameLowering.cpp +++ lib/Target/XCore/XCoreFrameLowering.cpp @@ -151,7 +151,7 @@ Offset, FramePtr)); } - llvm::sort(SpillList.begin(), SpillList.end(), CompareSSIOffset); + llvm::sort(SpillList, CompareSSIOffset); } /// Creates an ordered list of EH info register 'spills'. @@ -170,7 +170,7 @@ SpillList.push_back( StackSlotInfo(EHSlot[0], MFI.getObjectOffset(EHSlot[1]), TL->getExceptionSelectorRegister(PersonalityFn))); - llvm::sort(SpillList.begin(), SpillList.end(), CompareSSIOffset); + llvm::sort(SpillList, CompareSSIOffset); } static MachineMemOperand *getFrameIndexMMO(MachineBasicBlock &MBB, Index: lib/Target/XCore/XCoreLowerThreadLocal.cpp =================================================================== --- lib/Target/XCore/XCoreLowerThreadLocal.cpp +++ lib/Target/XCore/XCoreLowerThreadLocal.cpp @@ -129,7 +129,7 @@ static bool replaceConstantExprOp(ConstantExpr *CE, Pass *P) { do { SmallVector WUsers(CE->user_begin(), CE->user_end()); - llvm::sort(WUsers.begin(), WUsers.end()); + llvm::sort(WUsers); WUsers.erase(std::unique(WUsers.begin(), WUsers.end()), WUsers.end()); while (!WUsers.empty()) if (WeakTrackingVH WU = WUsers.pop_back_val()) { Index: lib/Transforms/Coroutines/CoroFrame.cpp =================================================================== --- lib/Transforms/Coroutines/CoroFrame.cpp +++ lib/Transforms/Coroutines/CoroFrame.cpp @@ -49,7 +49,7 @@ BlockToIndexMapping(Function &F) { for (BasicBlock &BB : F) V.push_back(&BB); - llvm::sort(V.begin(), V.end()); + llvm::sort(V); } size_t blockToIndex(BasicBlock *BB) const { Index: lib/Transforms/IPO/LowerTypeTests.cpp =================================================================== --- lib/Transforms/IPO/LowerTypeTests.cpp +++ lib/Transforms/IPO/LowerTypeTests.cpp @@ -1997,7 +1997,7 @@ } Sets.emplace_back(I, MaxUniqueId); } - llvm::sort(Sets.begin(), Sets.end(), + llvm::sort(Sets, [](const std::pair &S1, const std::pair &S2) { return S1.second < S2.second; @@ -2022,12 +2022,12 @@ // Order type identifiers by unique ID for determinism. This ordering is // stable as there is a one-to-one mapping between metadata and unique IDs. - llvm::sort(TypeIds.begin(), TypeIds.end(), [&](Metadata *M1, Metadata *M2) { + llvm::sort(TypeIds, [&](Metadata *M1, Metadata *M2) { return TypeIdInfo[M1].UniqueId < TypeIdInfo[M2].UniqueId; }); // Same for the branch funnels. - llvm::sort(ICallBranchFunnels.begin(), ICallBranchFunnels.end(), + llvm::sort(ICallBranchFunnels, [&](ICallBranchFunnel *F1, ICallBranchFunnel *F2) { return F1->UniqueId < F2->UniqueId; }); Index: lib/Transforms/IPO/SampleProfile.cpp =================================================================== --- lib/Transforms/IPO/SampleProfile.cpp +++ lib/Transforms/IPO/SampleProfile.cpp @@ -681,7 +681,7 @@ Sum += NameFS.second.getEntrySamples(); R.push_back(&NameFS.second); } - llvm::sort(R.begin(), R.end(), + llvm::sort(R, [](const FunctionSamples *L, const FunctionSamples *R) { if (L->getEntrySamples() != R->getEntrySamples()) return L->getEntrySamples() > R->getEntrySamples(); @@ -1174,7 +1174,7 @@ SmallVector R; for (auto I = M.begin(); I != M.end(); ++I) R.push_back({FunctionSamples::getGUID(I->getKey()), I->getValue()}); - llvm::sort(R.begin(), R.end(), + llvm::sort(R, [](const InstrProfValueData &L, const InstrProfValueData &R) { if (L.Count == R.Count) return L.Value > R.Value; Index: lib/Transforms/Scalar/GVNHoist.cpp =================================================================== --- lib/Transforms/Scalar/GVNHoist.cpp +++ lib/Transforms/Scalar/GVNHoist.cpp @@ -748,7 +748,7 @@ // TODO: Remove fully-redundant expressions. // Get instruction from the Map, assume that all the Instructions // with same VNs have same rank (this is an approximation). - llvm::sort(Ranks.begin(), Ranks.end(), + llvm::sort(Ranks, [this, &Map](const VNType &r1, const VNType &r2) { return (rank(*Map.lookup(r1).begin()) < rank(*Map.lookup(r2).begin())); Index: lib/Transforms/Scalar/GVNSink.cpp =================================================================== --- lib/Transforms/Scalar/GVNSink.cpp +++ lib/Transforms/Scalar/GVNSink.cpp @@ -239,7 +239,7 @@ SmallVector, 4> Ops; for (unsigned I = 0, E = PN->getNumIncomingValues(); I != E; ++I) Ops.push_back({PN->getIncomingBlock(I), PN->getIncomingValue(I)}); - llvm::sort(Ops.begin(), Ops.end()); + llvm::sort(Ops); for (auto &P : Ops) { Blocks.push_back(P.first); Values.push_back(P.second); @@ -361,7 +361,7 @@ for (auto &U : I->uses()) op_push_back(U.getUser()); - llvm::sort(op_begin(), op_end()); + llvm::sort(op); } void setMemoryUseOrder(unsigned MUO) { MemoryUseOrder = MUO; } @@ -762,7 +762,7 @@ } if (Preds.size() < 2) return 0; - llvm::sort(Preds.begin(), Preds.end()); + llvm::sort(Preds); unsigned NumOrigPreds = Preds.size(); // We can only sink instructions through unconditional branches. Index: lib/Transforms/Scalar/GuardWidening.cpp =================================================================== --- lib/Transforms/Scalar/GuardWidening.cpp +++ lib/Transforms/Scalar/GuardWidening.cpp @@ -698,7 +698,7 @@ // CurrentChecks.size() will typically be 3 here, but so far there has been // no need to hard-code that fact. - llvm::sort(CurrentChecks.begin(), CurrentChecks.end(), + llvm::sort(CurrentChecks, [&](const GuardWideningImpl::RangeCheck &LHS, const GuardWideningImpl::RangeCheck &RHS) { return LHS.getOffsetValue().slt(RHS.getOffsetValue()); Index: lib/Transforms/Scalar/LoopSink.cpp =================================================================== --- lib/Transforms/Scalar/LoopSink.cpp +++ lib/Transforms/Scalar/LoopSink.cpp @@ -208,7 +208,7 @@ SmallVector SortedBBsToSinkInto; SortedBBsToSinkInto.insert(SortedBBsToSinkInto.begin(), BBsToSinkInto.begin(), BBsToSinkInto.end()); - llvm::sort(SortedBBsToSinkInto.begin(), SortedBBsToSinkInto.end(), + llvm::sort(SortedBBsToSinkInto, [&](BasicBlock *A, BasicBlock *B) { return LoopBlockNumber.find(A)->second < LoopBlockNumber.find(B)->second; Index: lib/Transforms/Scalar/LoopStrengthReduce.cpp =================================================================== --- lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -1487,7 +1487,7 @@ SmallVector Key = F.BaseRegs; if (F.ScaledReg) Key.push_back(F.ScaledReg); // Unstable sort by host order ok, because this is only used for uniquifying. - llvm::sort(Key.begin(), Key.end()); + llvm::sort(Key); return Uniquifier.count(Key); } @@ -1511,7 +1511,7 @@ SmallVector Key = F.BaseRegs; if (F.ScaledReg) Key.push_back(F.ScaledReg); // Unstable sort by host order ok, because this is only used for uniquifying. - llvm::sort(Key.begin(), Key.end()); + llvm::sort(Key); if (!Uniquifier.insert(Key).second) return false; @@ -4238,7 +4238,7 @@ Key.push_back(F.ScaledReg); // Unstable sort by host order ok, because this is only used for // uniquifying. - llvm::sort(Key.begin(), Key.end()); + llvm::sort(Key); std::pair P = BestFormulae.insert(std::make_pair(Key, FIdx)); Index: lib/Transforms/Scalar/MergeICmps.cpp =================================================================== --- lib/Transforms/Scalar/MergeICmps.cpp +++ lib/Transforms/Scalar/MergeICmps.cpp @@ -465,7 +465,7 @@ #endif // MERGEICMPS_DOT_ON // Reorder blocks by LHS. We can do that without changing the // semantics because we are only accessing dereferencable memory. - llvm::sort(Comparisons_.begin(), Comparisons_.end(), + llvm::sort(Comparisons_, [](const BCECmpBlock &a, const BCECmpBlock &b) { return a.Lhs() < b.Lhs(); }); Index: lib/Transforms/Scalar/NewGVN.cpp =================================================================== --- lib/Transforms/Scalar/NewGVN.cpp +++ lib/Transforms/Scalar/NewGVN.cpp @@ -959,7 +959,7 @@ // order. The BlockInstRange numbers are generated in an RPO walk of the basic // blocks. void NewGVN::sortPHIOps(MutableArrayRef Ops) const { - llvm::sort(Ops.begin(), Ops.end(), + llvm::sort(Ops, [&](const ValPair &P1, const ValPair &P2) { return BlockInstRange.lookup(P1.second).first < BlockInstRange.lookup(P2.second).first; @@ -3955,7 +3955,7 @@ convertClassToDFSOrdered(*CC, DFSOrderedSet, UseCounts, ProbablyDead); // Sort the whole thing. - llvm::sort(DFSOrderedSet.begin(), DFSOrderedSet.end()); + llvm::sort(DFSOrderedSet); for (auto &VD : DFSOrderedSet) { int MemberDFSIn = VD.DFSIn; int MemberDFSOut = VD.DFSOut; @@ -4118,7 +4118,7 @@ // If we have possible dead stores to look at, try to eliminate them. if (CC->getStoreCount() > 0) { convertClassToLoadsAndStores(*CC, PossibleDeadStores); - llvm::sort(PossibleDeadStores.begin(), PossibleDeadStores.end()); + llvm::sort(PossibleDeadStores); ValueDFSStack EliminationStack; for (auto &VD : PossibleDeadStores) { int MemberDFSIn = VD.DFSIn; Index: lib/Transforms/Scalar/PlaceSafepoints.cpp =================================================================== --- lib/Transforms/Scalar/PlaceSafepoints.cpp +++ lib/Transforms/Scalar/PlaceSafepoints.cpp @@ -524,7 +524,7 @@ }; // We need the order of list to be stable so that naming ends up stable // when we split edges. This makes test cases much easier to write. - llvm::sort(PollLocations.begin(), PollLocations.end(), OrderByBBName); + llvm::sort(PollLocations, OrderByBBName); // We can sometimes end up with duplicate poll locations. This happens if // a single loop is visited more than once. The fact this happens seems Index: lib/Transforms/Scalar/RewriteStatepointsForGC.cpp =================================================================== --- lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -1825,7 +1825,7 @@ } } - llvm::sort(Uses.begin(), Uses.end()); + llvm::sort(Uses); auto Last = std::unique(Uses.begin(), Uses.end()); Uses.erase(Last, Uses.end()); Index: lib/Transforms/Scalar/SROA.cpp =================================================================== --- lib/Transforms/Scalar/SROA.cpp +++ lib/Transforms/Scalar/SROA.cpp @@ -1060,7 +1060,7 @@ // Sort the uses. This arranges for the offsets to be in ascending order, // and the sizes to be in descending order. - llvm::sort(Slices.begin(), Slices.end()); + llvm::sort(Slices); } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) @@ -1906,7 +1906,7 @@ "All non-integer types eliminated!"); return RHSTy->getNumElements() < LHSTy->getNumElements(); }; - llvm::sort(CandidateTys.begin(), CandidateTys.end(), RankVectorTypes); + llvm::sort(CandidateTys, RankVectorTypes); CandidateTys.erase( std::unique(CandidateTys.begin(), CandidateTys.end(), RankVectorTypes), CandidateTys.end()); @@ -4221,7 +4221,7 @@ } if (!IsSorted) - llvm::sort(AS.begin(), AS.end()); + llvm::sort(AS); /// Describes the allocas introduced by rewritePartition in order to migrate /// the debug info. Index: lib/Transforms/Scalar/SimpleLoopUnswitch.cpp =================================================================== --- lib/Transforms/Scalar/SimpleLoopUnswitch.cpp +++ lib/Transforms/Scalar/SimpleLoopUnswitch.cpp @@ -1265,7 +1265,7 @@ // matter as we're just trying to build up the map from inside-out; we use // the map in a more stably ordered way below. auto OrderedClonedExitsInLoops = ClonedExitsInLoops; - llvm::sort(OrderedClonedExitsInLoops.begin(), OrderedClonedExitsInLoops.end(), + llvm::sort(OrderedClonedExitsInLoops, [&](BasicBlock *LHS, BasicBlock *RHS) { return ExitLoopMap.lookup(LHS)->getLoopDepth() < ExitLoopMap.lookup(RHS)->getLoopDepth(); Index: lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp =================================================================== --- lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp +++ lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp @@ -161,7 +161,7 @@ void ImportedFunctionsInliningStatistics::calculateRealInlines() { // Removing duplicated Callers. - llvm::sort(NonImportedCallers.begin(), NonImportedCallers.end()); + llvm::sort(NonImportedCallers); NonImportedCallers.erase( std::unique(NonImportedCallers.begin(), NonImportedCallers.end()), NonImportedCallers.end()); Index: lib/Transforms/Utils/LowerSwitch.cpp =================================================================== --- lib/Transforms/Utils/LowerSwitch.cpp +++ lib/Transforms/Utils/LowerSwitch.cpp @@ -372,7 +372,7 @@ Cases.push_back(CaseRange(Case.getCaseValue(), Case.getCaseValue(), Case.getCaseSuccessor())); - llvm::sort(Cases.begin(), Cases.end(), CaseCmp()); + llvm::sort(Cases, CaseCmp()); // Merge case into clusters if (Cases.size() >= 2) { Index: lib/Transforms/Utils/PredicateInfo.cpp =================================================================== --- lib/Transforms/Utils/PredicateInfo.cpp +++ lib/Transforms/Utils/PredicateInfo.cpp @@ -569,7 +569,7 @@ auto Comparator = [&](const Value *A, const Value *B) { return valueComesBefore(OI, A, B); }; - llvm::sort(OpsToRename.begin(), OpsToRename.end(), Comparator); + llvm::sort(OpsToRename, Comparator); ValueDFS_Compare Compare(OI); // Compute liveness, and rename in O(uses) per Op. for (auto *Op : OpsToRename) { Index: lib/Transforms/Utils/PromoteMemoryToRegister.cpp =================================================================== --- lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -477,7 +477,7 @@ // Sort the stores by their index, making it efficient to do a lookup with a // binary search. - llvm::sort(StoresByIndex.begin(), StoresByIndex.end(), less_first()); + llvm::sort(StoresByIndex, less_first()); // Walk all of the loads from this alloca, replacing them with the nearest // store above them, if any. @@ -638,7 +638,7 @@ SmallVector PHIBlocks; IDF.calculate(PHIBlocks); if (PHIBlocks.size() > 1) - llvm::sort(PHIBlocks.begin(), PHIBlocks.end(), + llvm::sort(PHIBlocks, [this](BasicBlock *A, BasicBlock *B) { return BBNumbers.lookup(A) < BBNumbers.lookup(B); }); @@ -752,7 +752,7 @@ // Ok, now we know that all of the PHI nodes are missing entries for some // basic blocks. Start by sorting the incoming predecessors for efficient // access. - llvm::sort(Preds.begin(), Preds.end()); + llvm::sort(Preds); // Now we loop through all BB's which have entries in SomePHI and remove // them from the Preds list. Index: lib/Transforms/Utils/SimplifyCFG.cpp =================================================================== --- lib/Transforms/Utils/SimplifyCFG.cpp +++ lib/Transforms/Utils/SimplifyCFG.cpp @@ -5521,7 +5521,7 @@ SmallVector Values; for (auto &C : SI->cases()) Values.push_back(C.getCaseValue()->getValue().getSExtValue()); - llvm::sort(Values.begin(), Values.end()); + llvm::sort(Values); // If the switch is already dense, there's nothing useful to do here. if (isSwitchDense(Values)) Index: lib/Transforms/Utils/SplitModule.cpp =================================================================== --- lib/Transforms/Utils/SplitModule.cpp +++ lib/Transforms/Utils/SplitModule.cpp @@ -181,7 +181,7 @@ std::make_pair(std::distance(GVtoClusterMap.member_begin(I), GVtoClusterMap.member_end()), I)); - llvm::sort(Sets.begin(), Sets.end(), + llvm::sort(Sets, [](const SortType &a, const SortType &b) { if (a.first == b.first) return a.second->getData()->getName() > Index: tools/dsymutil/DwarfLinker.cpp =================================================================== --- tools/dsymutil/DwarfLinker.cpp +++ tools/dsymutil/DwarfLinker.cpp @@ -484,7 +484,7 @@ // the file, this allows us to just keep an index in the relocation // array that we advance during our walk, rather than resorting to // some associative container. See DwarfLinker::NextValidReloc. - llvm::sort(ValidRelocs.begin(), ValidRelocs.end()); + llvm::sort(ValidRelocs); return true; } Index: tools/dsymutil/DwarfStreamer.cpp =================================================================== --- tools/dsymutil/DwarfStreamer.cpp +++ tools/dsymutil/DwarfStreamer.cpp @@ -320,7 +320,7 @@ // The object addresses where sorted, but again, the linked // addresses might end up in a different order. - llvm::sort(Ranges.begin(), Ranges.end()); + llvm::sort(Ranges); if (!Ranges.empty()) { MS->SwitchSection(MC->getObjectFileInfo()->getDwarfARangesSection()); Index: tools/llvm-config/llvm-config.cpp =================================================================== --- tools/llvm-config/llvm-config.cpp +++ tools/llvm-config/llvm-config.cpp @@ -523,7 +523,7 @@ if (DyLibExists && !sys::fs::exists(path)) { Components = GetAllDyLibComponents(IsInDevelopmentTree, true, DirSep); - llvm::sort(Components.begin(), Components.end()); + llvm::sort(Components); break; } } Index: tools/llvm-dwarfdump/llvm-dwarfdump.cpp =================================================================== --- tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -358,7 +358,7 @@ getDies(DICtx, DICtx.getAppleNamespaces(), Name, Dies); getDies(DICtx, DICtx.getDebugNames(), Name, Dies); } - llvm::sort(Dies.begin(), Dies.end()); + llvm::sort(Dies); Dies.erase(std::unique(Dies.begin(), Dies.end()), Dies.end()); for (DWARFDie Die : Dies) Index: tools/llvm-exegesis/lib/Analysis.cpp =================================================================== --- tools/llvm-exegesis/lib/Analysis.cpp +++ tools/llvm-exegesis/lib/Analysis.cpp @@ -668,10 +668,9 @@ llvm::SmallVector &DensePressure) { // Find the number of subunits with minimal pressure (they are at the // front). - llvm::sort(Subunits.begin(), Subunits.end(), - [&DensePressure](const uint16_t A, const uint16_t B) { - return DensePressure[A] < DensePressure[B]; - }); + llvm::sort(Subunits, [&DensePressure](const uint16_t A, const uint16_t B) { + return DensePressure[A] < DensePressure[B]; + }); const auto getPressureForSubunit = [&DensePressure, &Subunits](size_t I) -> float & { return DensePressure[Subunits[I]]; @@ -718,7 +717,7 @@ llvm::SmallVector WPRS) { // DensePressure[I] is the port pressure for Proc Resource I. llvm::SmallVector DensePressure(SM.getNumProcResourceKinds()); - llvm::sort(WPRS.begin(), WPRS.end(), + llvm::sort(WPRS, [](const llvm::MCWriteProcResEntry &A, const llvm::MCWriteProcResEntry &B) { return A.ProcResourceIdx < B.ProcResourceIdx; Index: tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp =================================================================== --- tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp +++ tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp @@ -260,7 +260,7 @@ } // Remove duplicate entries and resize the input vector. - llvm::sort(Writes.begin(), Writes.end(), + llvm::sort(Writes, [](const WriteRef &Lhs, const WriteRef &Rhs) { return Lhs.getWriteState() < Rhs.getWriteState(); }); Index: tools/llvm-mca/lib/InstrBuilder.cpp =================================================================== --- tools/llvm-mca/lib/InstrBuilder.cpp +++ tools/llvm-mca/lib/InstrBuilder.cpp @@ -64,7 +64,7 @@ // Sort elements by mask popcount, so that we prioritize resource units over // resource groups, and smaller groups over larger groups. - llvm::sort(Worklist.begin(), Worklist.end(), + llvm::sort(Worklist, [](const ResourcePlusCycles &A, const ResourcePlusCycles &B) { unsigned popcntA = countPopulation(A.first); unsigned popcntB = countPopulation(B.first); Index: tools/llvm-nm/llvm-nm.cpp =================================================================== --- tools/llvm-nm/llvm-nm.cpp +++ tools/llvm-nm/llvm-nm.cpp @@ -709,7 +709,7 @@ if (ReverseSort) Cmp = [=](const NMSymbol &A, const NMSymbol &B) { return Cmp(B, A); }; - llvm::sort(SymbolList.begin(), SymbolList.end(), Cmp); + llvm::sort(SymbolList, Cmp); } if (!PrintFileName) { Index: tools/llvm-objdump/COFFDump.cpp =================================================================== --- tools/llvm-objdump/COFFDump.cpp +++ tools/llvm-objdump/COFFDump.cpp @@ -454,7 +454,7 @@ Rels.push_back(Reloc); // Sort relocations by address. - llvm::sort(Rels.begin(), Rels.end(), RelocAddressLess); + llvm::sort(Rels, RelocAddressLess); ArrayRef Contents; error(Obj->getSectionContents(Pdata, Contents)); Index: tools/llvm-objdump/MachODump.cpp =================================================================== --- tools/llvm-objdump/MachODump.cpp +++ tools/llvm-objdump/MachODump.cpp @@ -6922,7 +6922,7 @@ BaseSegmentAddress); // Sort the symbols by address, just in case they didn't come in that way. - llvm::sort(Symbols.begin(), Symbols.end(), SymbolSorter()); + llvm::sort(Symbols, SymbolSorter()); // Build a data in code table that is sorted on by the address of each entry. uint64_t BaseAddress = 0; Index: tools/llvm-objdump/llvm-objdump.cpp =================================================================== --- tools/llvm-objdump/llvm-objdump.cpp +++ tools/llvm-objdump/llvm-objdump.cpp @@ -1447,8 +1447,8 @@ } } - llvm::sort(DataMappingSymsAddr.begin(), DataMappingSymsAddr.end()); - llvm::sort(TextMappingSymsAddr.begin(), TextMappingSymsAddr.end()); + llvm::sort(DataMappingSymsAddr); + llvm::sort(TextMappingSymsAddr); if (Obj->isELF() && Obj->getArch() == Triple::amdgcn) { // AMDGPU disassembler uses symbolizer for printing labels @@ -1473,7 +1473,7 @@ } // Sort relocations by address. - llvm::sort(Rels.begin(), Rels.end(), RelocAddressLess); + llvm::sort(Rels, RelocAddressLess); StringRef SegmentName = ""; if (const MachOObjectFile *MachO = dyn_cast(Obj)) { Index: tools/llvm-pdbutil/DumpOutputStyle.cpp =================================================================== --- tools/llvm-pdbutil/DumpOutputStyle.cpp +++ tools/llvm-pdbutil/DumpOutputStyle.cpp @@ -1118,7 +1118,7 @@ std::vector SortedIDs(IS->name_ids().begin(), IS->name_ids().end()); - llvm::sort(SortedIDs.begin(), SortedIDs.end()); + llvm::sort(SortedIDs); for (uint32_t I : SortedIDs) { auto ES = IS->getStringForID(I); llvm::SmallString<32> Str; Index: tools/llvm-pdbutil/PrettyTypeDumper.cpp =================================================================== --- tools/llvm-pdbutil/PrettyTypeDumper.cpp +++ tools/llvm-pdbutil/PrettyTypeDumper.cpp @@ -130,7 +130,7 @@ } if (Comp) - llvm::sort(Filtered.begin(), Filtered.end(), Comp); + llvm::sort(Filtered, Comp); return Filtered; } Index: tools/llvm-pdbutil/llvm-pdbutil.cpp =================================================================== --- tools/llvm-pdbutil/llvm-pdbutil.cpp +++ tools/llvm-pdbutil/llvm-pdbutil.cpp @@ -1216,7 +1216,7 @@ std::vector> Funcs; while (auto Func = Functions->getNext()) Funcs.push_back(std::move(Func)); - llvm::sort(Funcs.begin(), Funcs.end(), + llvm::sort(Funcs, opts::pretty::compareFunctionSymbols); for (const auto &Func : Funcs) { Printer.NewLine(); @@ -1235,7 +1235,7 @@ std::vector> Datas; while (auto Var = Vars->getNext()) Datas.push_back(std::move(Var)); - llvm::sort(Datas.begin(), Datas.end(), + llvm::sort(Datas, opts::pretty::compareDataSymbols); for (const auto &Var : Datas) Dumper.start(*Var); Index: tools/llvm-readobj/COFFDumper.cpp =================================================================== --- tools/llvm-readobj/COFFDumper.cpp +++ tools/llvm-readobj/COFFDumper.cpp @@ -613,8 +613,7 @@ RelocMap[Section].push_back(Reloc); // Sort relocations by address. - llvm::sort(RelocMap[Section].begin(), RelocMap[Section].end(), - relocAddressLess); + llvm::sort(RelocMap[Section], relocAddressLess); } } Index: tools/llvm-xray/xray-account.cpp =================================================================== --- tools/llvm-xray/xray-account.cpp +++ tools/llvm-xray/xray-account.cpp @@ -282,7 +282,7 @@ // Sort the data according to user-provided flags. switch (AccountSortOutput) { case SortField::FUNCID: - llvm::sort(Results.begin(), Results.end(), + llvm::sort(Results, [](const TupleType &L, const TupleType &R) { if (AccountSortOrder == SortDirection::ASCENDING) return std::get<0>(L) < std::get<0>(R); @@ -292,7 +292,7 @@ }); break; case SortField::COUNT: - llvm::sort(Results.begin(), Results.end(), + llvm::sort(Results, [](const TupleType &L, const TupleType &R) { if (AccountSortOrder == SortDirection::ASCENDING) return std::get<1>(L) < std::get<1>(R); @@ -304,7 +304,7 @@ default: // Here we need to look into the ResultRow for the rest of the data that // we want to sort by. - llvm::sort(Results.begin(), Results.end(), + llvm::sort(Results, [&](const TupleType &L, const TupleType &R) { auto &LR = std::get<2>(L); auto &RR = std::get<2>(R); Index: tools/yaml2obj/yaml2macho.cpp =================================================================== --- tools/yaml2obj/yaml2macho.cpp +++ tools/yaml2obj/yaml2macho.cpp @@ -417,7 +417,7 @@ } } - llvm::sort(WriteQueue.begin(), WriteQueue.end(), + llvm::sort(WriteQueue, [](const writeOperation &a, const writeOperation &b) { return a.first < b.first; }); Index: unittests/ADT/StringMapTest.cpp =================================================================== --- unittests/ADT/StringMapTest.cpp +++ unittests/ADT/StringMapTest.cpp @@ -279,7 +279,7 @@ Map["D"] = 3; auto Keys = to_vector<4>(Map.keys()); - llvm::sort(Keys.begin(), Keys.end()); + llvm::sort(Keys); SmallVector Expected = {"A", "B", "C", "D"}; EXPECT_EQ(Expected, Keys); @@ -293,7 +293,7 @@ Set.insert("D"); auto Keys = to_vector<4>(Set.keys()); - llvm::sort(Keys.begin(), Keys.end()); + llvm::sort(Keys); SmallVector Expected = {"A", "B", "C", "D"}; EXPECT_EQ(Expected, Keys); Index: unittests/Analysis/LazyCallGraphTest.cpp =================================================================== --- unittests/Analysis/LazyCallGraphTest.cpp +++ unittests/Analysis/LazyCallGraphTest.cpp @@ -264,7 +264,7 @@ for (LazyCallGraph::Edge &E : A1.populate()) Nodes.push_back(E.getFunction().getName()); - llvm::sort(Nodes.begin(), Nodes.end()); + llvm::sort(Nodes); EXPECT_EQ("a2", Nodes[0]); EXPECT_EQ("b2", Nodes[1]); EXPECT_EQ("c3", Nodes[2]); @@ -279,7 +279,7 @@ for (LazyCallGraph::Edge &E : B1.populate()) Nodes.push_back(E.getFunction().getName()); - llvm::sort(Nodes.begin(), Nodes.end()); + llvm::sort(Nodes); EXPECT_EQ("b2", Nodes[0]); EXPECT_EQ("d3", Nodes[1]); Nodes.clear(); @@ -293,7 +293,7 @@ for (LazyCallGraph::Edge &E : C1.populate()) Nodes.push_back(E.getFunction().getName()); - llvm::sort(Nodes.begin(), Nodes.end()); + llvm::sort(Nodes); EXPECT_EQ("c2", Nodes[0]); EXPECT_EQ("d2", Nodes[1]); Nodes.clear(); @@ -323,7 +323,7 @@ ASSERT_EQ(1, D.size()); for (LazyCallGraph::Node &N : *D.begin()) Nodes.push_back(N.getFunction().getName()); - llvm::sort(Nodes.begin(), Nodes.end()); + llvm::sort(Nodes); EXPECT_EQ(3u, Nodes.size()); EXPECT_EQ("d1", Nodes[0]); EXPECT_EQ("d2", Nodes[1]); @@ -339,7 +339,7 @@ ASSERT_EQ(1, C.size()); for (LazyCallGraph::Node &N : *C.begin()) Nodes.push_back(N.getFunction().getName()); - llvm::sort(Nodes.begin(), Nodes.end()); + llvm::sort(Nodes); EXPECT_EQ(3u, Nodes.size()); EXPECT_EQ("c1", Nodes[0]); EXPECT_EQ("c2", Nodes[1]); @@ -355,7 +355,7 @@ ASSERT_EQ(1, B.size()); for (LazyCallGraph::Node &N : *B.begin()) Nodes.push_back(N.getFunction().getName()); - llvm::sort(Nodes.begin(), Nodes.end()); + llvm::sort(Nodes); EXPECT_EQ(3u, Nodes.size()); EXPECT_EQ("b1", Nodes[0]); EXPECT_EQ("b2", Nodes[1]); @@ -373,7 +373,7 @@ ASSERT_EQ(1, A.size()); for (LazyCallGraph::Node &N : *A.begin()) Nodes.push_back(N.getFunction().getName()); - llvm::sort(Nodes.begin(), Nodes.end()); + llvm::sort(Nodes); EXPECT_EQ(3u, Nodes.size()); EXPECT_EQ("a1", Nodes[0]); EXPECT_EQ("a2", Nodes[1]); @@ -477,7 +477,7 @@ LazyCallGraph::SCC &D = *J++; for (LazyCallGraph::Node &N : D) Nodes.push_back(N.getFunction().getName()); - llvm::sort(Nodes.begin(), Nodes.end()); + llvm::sort(Nodes); EXPECT_EQ(3u, Nodes.size()); EXPECT_EQ("d1", Nodes[0]); EXPECT_EQ("d2", Nodes[1]); @@ -487,7 +487,7 @@ LazyCallGraph::SCC &B = *J++; for (LazyCallGraph::Node &N : B) Nodes.push_back(N.getFunction().getName()); - llvm::sort(Nodes.begin(), Nodes.end()); + llvm::sort(Nodes); EXPECT_EQ(3u, Nodes.size()); EXPECT_EQ("b1", Nodes[0]); EXPECT_EQ("b2", Nodes[1]); @@ -497,7 +497,7 @@ LazyCallGraph::SCC &C = *J++; for (LazyCallGraph::Node &N : C) Nodes.push_back(N.getFunction().getName()); - llvm::sort(Nodes.begin(), Nodes.end()); + llvm::sort(Nodes); EXPECT_EQ(3u, Nodes.size()); EXPECT_EQ("c1", Nodes[0]); EXPECT_EQ("c2", Nodes[1]); @@ -507,7 +507,7 @@ LazyCallGraph::SCC &A = *J++; for (LazyCallGraph::Node &N : A) Nodes.push_back(N.getFunction().getName()); - llvm::sort(Nodes.begin(), Nodes.end()); + llvm::sort(Nodes); EXPECT_EQ(3u, Nodes.size()); EXPECT_EQ("a1", Nodes[0]); EXPECT_EQ("a2", Nodes[1]); Index: unittests/Analysis/MemorySSATest.cpp =================================================================== --- unittests/Analysis/MemorySSATest.cpp +++ unittests/Analysis/MemorySSATest.cpp @@ -1363,7 +1363,7 @@ ASSERT_LT(StoreBAccess->getID(), StoreA2Access->getID()); auto SortVecByID = [](std::vector &Defs) { - llvm::sort(Defs.begin(), Defs.end(), + llvm::sort(Defs, [](const MemoryDef *LHS, const MemoryDef *RHS) { return LHS->getID() < RHS->getID(); }); Index: unittests/Support/Path.cpp =================================================================== --- unittests/Support/Path.cpp +++ unittests/Support/Path.cpp @@ -895,8 +895,8 @@ ASSERT_NO_ERROR(ec); VisitedNonBrokenSymlinks.push_back(path::filename(i->path())); } - llvm::sort(VisitedNonBrokenSymlinks.begin(), VisitedNonBrokenSymlinks.end()); - llvm::sort(VisitedBrokenSymlinks.begin(), VisitedBrokenSymlinks.end()); + llvm::sort(VisitedNonBrokenSymlinks); + llvm::sort(VisitedBrokenSymlinks); v_t ExpectedNonBrokenSymlinks = {"b", "d"}; ASSERT_EQ(ExpectedNonBrokenSymlinks.size(), VisitedNonBrokenSymlinks.size()); ASSERT_TRUE(std::equal(VisitedNonBrokenSymlinks.begin(), @@ -922,8 +922,8 @@ ASSERT_NO_ERROR(ec); VisitedNonBrokenSymlinks.push_back(path::filename(i->path())); } - llvm::sort(VisitedNonBrokenSymlinks.begin(), VisitedNonBrokenSymlinks.end()); - llvm::sort(VisitedBrokenSymlinks.begin(), VisitedBrokenSymlinks.end()); + llvm::sort(VisitedNonBrokenSymlinks); + llvm::sort(VisitedBrokenSymlinks); ExpectedNonBrokenSymlinks = {"b", "bb", "d", "da", "dd", "ddd", "ddd"}; ASSERT_EQ(ExpectedNonBrokenSymlinks.size(), VisitedNonBrokenSymlinks.size()); ASSERT_TRUE(std::equal(VisitedNonBrokenSymlinks.begin(), @@ -949,8 +949,8 @@ ASSERT_NO_ERROR(ec); VisitedNonBrokenSymlinks.push_back(path::filename(i->path())); } - llvm::sort(VisitedNonBrokenSymlinks.begin(), VisitedNonBrokenSymlinks.end()); - llvm::sort(VisitedBrokenSymlinks.begin(), VisitedBrokenSymlinks.end()); + llvm::sort(VisitedNonBrokenSymlinks); + llvm::sort(VisitedBrokenSymlinks); ExpectedNonBrokenSymlinks = {"a", "b", "ba", "bb", "bc", "c", "d", "da", "dd", "ddd", "e"}; ASSERT_EQ(ExpectedNonBrokenSymlinks.size(), VisitedNonBrokenSymlinks.size()); Index: utils/TableGen/CTagsEmitter.cpp =================================================================== --- utils/TableGen/CTagsEmitter.cpp +++ utils/TableGen/CTagsEmitter.cpp @@ -73,7 +73,7 @@ for (const auto &D : Defs) Tags.push_back(Tag(D.first, locate(D.second.get()))); // Emit tags. - llvm::sort(Tags.begin(), Tags.end()); + llvm::sort(Tags); OS << "!_TAG_FILE_FORMAT\t1\t/original ctags format/\n"; OS << "!_TAG_FILE_SORTED\t1\t/0=unsorted, 1=sorted, 2=foldcase/\n"; for (const Tag &T : Tags) Index: utils/TableGen/CodeGenDAGPatterns.cpp =================================================================== --- utils/TableGen/CodeGenDAGPatterns.cpp +++ utils/TableGen/CodeGenDAGPatterns.cpp @@ -1318,7 +1318,7 @@ SmallVector PredList; for (const Predicate &P : Predicates) PredList.push_back(&P); - llvm::sort(PredList.begin(), PredList.end(), deref()); + llvm::sort(PredList, deref()); std::string Check; for (unsigned i = 0, e = PredList.size(); i != e; ++i) { @@ -3742,7 +3742,7 @@ } // Sort so that different orders get canonicalized to the same string. - llvm::sort(Preds.begin(), Preds.end()); + llvm::sort(Preds); return Preds; } Index: utils/TableGen/CodeGenRegisters.cpp =================================================================== --- utils/TableGen/CodeGenRegisters.cpp +++ utils/TableGen/CodeGenRegisters.cpp @@ -725,7 +725,7 @@ //===----------------------------------------------------------------------===// static void sortAndUniqueRegisters(CodeGenRegister::Vec &M) { - llvm::sort(M.begin(), M.end(), deref()); + llvm::sort(M, deref()); M.erase(std::unique(M.begin(), M.end(), deref()), M.end()); } @@ -997,7 +997,7 @@ for (auto &RC : RegClasses) if (SuperRegRCsBV[RC.EnumValue]) SuperRegRCs.emplace_back(&RC); - llvm::sort(SuperRegRCs.begin(), SuperRegRCs.end(), SizeOrder); + llvm::sort(SuperRegRCs, SizeOrder); assert(SuperRegRCs.front() == BiggestSuperRegRC && "Biggest class wasn't first"); // Find all the subreg classes and order them by size too. @@ -1008,7 +1008,7 @@ if (SuperRegClassesBV.any()) SuperRegClasses.push_back(std::make_pair(&RC, SuperRegClassesBV)); } - llvm::sort(SuperRegClasses.begin(), SuperRegClasses.end(), + llvm::sort(SuperRegClasses, [&](const std::pair &A, const std::pair &B) { return SizeOrder(A.first, B.first); @@ -1073,7 +1073,7 @@ if (!RU.Artificial) TmpUnits.push_back(*UnitI); } - llvm::sort(TmpUnits.begin(), TmpUnits.end()); + llvm::sort(TmpUnits); std::unique_copy(TmpUnits.begin(), TmpUnits.end(), std::back_inserter(RegUnits)); } @@ -1093,7 +1093,7 @@ // Read in the user-defined (named) sub-register indices. // More indices will be synthesized later. std::vector SRIs = Records.getAllDerivedDefinitions("SubRegIndex"); - llvm::sort(SRIs.begin(), SRIs.end(), LessRecord()); + llvm::sort(SRIs, LessRecord()); for (unsigned i = 0, e = SRIs.size(); i != e; ++i) getSubRegIdx(SRIs[i]); // Build composite maps from ComposedOf fields. @@ -1102,7 +1102,7 @@ // Read in the register definitions. std::vector Regs = Records.getAllDerivedDefinitions("Register"); - llvm::sort(Regs.begin(), Regs.end(), LessRecordRegister()); + llvm::sort(Regs, LessRecordRegister()); // Assign the enumeration values. for (unsigned i = 0, e = Regs.size(); i != e; ++i) getReg(Regs[i]); @@ -1113,7 +1113,7 @@ for (Record *R : Tups) { std::vector TupRegs = *Sets.expand(R); - llvm::sort(TupRegs.begin(), TupRegs.end(), LessRecordRegister()); + llvm::sort(TupRegs, LessRecordRegister()); for (Record *RC : TupRegs) getReg(RC); } Index: utils/TableGen/CodeGenSchedule.cpp =================================================================== --- utils/TableGen/CodeGenSchedule.cpp +++ utils/TableGen/CodeGenSchedule.cpp @@ -365,7 +365,7 @@ // Sort OpcodeMappings elements based on their CPU and predicate masks. // As a last resort, order elements by opcode identifier. - llvm::sort(OpcodeMappings.begin(), OpcodeMappings.end(), + llvm::sort(OpcodeMappings, [&](const OpcodeMapPair &Lhs, const OpcodeMapPair &Rhs) { unsigned LhsIdx = Opcode2Index[Lhs.first]; unsigned RhsIdx = Opcode2Index[Rhs.first]; @@ -496,7 +496,7 @@ /// Gather all processor models. void CodeGenSchedModels::collectProcModels() { RecVec ProcRecords = Records.getAllDerivedDefinitions("Processor"); - llvm::sort(ProcRecords.begin(), ProcRecords.end(), LessRecordFieldName()); + llvm::sort(ProcRecords, LessRecordFieldName()); // Reserve space because we can. Reallocation would be ok. ProcModels.reserve(ProcRecords.size()+1); @@ -615,7 +615,7 @@ // Find all ReadWrites referenced by SchedAlias. AliasDefs needs to be sorted // for the loop below that initializes Alias vectors. RecVec AliasDefs = Records.getAllDerivedDefinitions("SchedAlias"); - llvm::sort(AliasDefs.begin(), AliasDefs.end(), LessRecord()); + llvm::sort(AliasDefs, LessRecord()); for (Record *ADef : AliasDefs) { Record *MatchDef = ADef->getValueAsDef("MatchRW"); Record *AliasDef = ADef->getValueAsDef("AliasRW"); @@ -633,12 +633,12 @@ } // Sort and add the SchedReadWrites directly referenced by instructions or // itinerary resources. Index reads and writes in separate domains. - llvm::sort(SWDefs.begin(), SWDefs.end(), LessRecord()); + llvm::sort(SWDefs, LessRecord()); for (Record *SWDef : SWDefs) { assert(!getSchedRWIdx(SWDef, /*IsRead=*/false) && "duplicate SchedWrite"); SchedWrites.emplace_back(SchedWrites.size(), SWDef); } - llvm::sort(SRDefs.begin(), SRDefs.end(), LessRecord()); + llvm::sort(SRDefs, LessRecord()); for (Record *SRDef : SRDefs) { assert(!getSchedRWIdx(SRDef, /*IsRead-*/true) && "duplicate SchedWrite"); SchedReads.emplace_back(SchedReads.size(), SRDef); @@ -858,7 +858,7 @@ } // Create classes for InstRW defs. RecVec InstRWDefs = Records.getAllDerivedDefinitions("InstRW"); - llvm::sort(InstRWDefs.begin(), InstRWDefs.end(), LessRecord()); + llvm::sort(InstRWDefs, LessRecord()); LLVM_DEBUG(dbgs() << "\n+++ SCHED CLASSES (createInstRWClass) +++\n"); for (Record *RWDef : InstRWDefs) createInstRWClass(RWDef); @@ -1162,7 +1162,7 @@ // Gather the read/write types for each itinerary class. void CodeGenSchedModels::collectProcItinRW() { RecVec ItinRWDefs = Records.getAllDerivedDefinitions("ItinRW"); - llvm::sort(ItinRWDefs.begin(), ItinRWDefs.end(), LessRecord()); + llvm::sort(ItinRWDefs, LessRecord()); for (Record *RWDef : ItinRWDefs) { if (!RWDef->getValueInit("SchedModel")->isComplete()) PrintFatalError(RWDef->getLoc(), "SchedModel is undefined"); Index: utils/TableGen/CodeGenTarget.cpp =================================================================== --- utils/TableGen/CodeGenTarget.cpp +++ utils/TableGen/CodeGenTarget.cpp @@ -278,7 +278,7 @@ void CodeGenTarget::ReadRegAltNameIndices() const { RegAltNameIndices = Records.getAllDerivedDefinitions("RegAltNameIndex"); - llvm::sort(RegAltNameIndices.begin(), RegAltNameIndices.end(), LessRecord()); + llvm::sort(RegAltNameIndices, LessRecord()); } /// getRegisterByName - If there is a register with the specific AsmName, @@ -303,7 +303,7 @@ } // Remove duplicates. - llvm::sort(Result.begin(), Result.end()); + llvm::sort(Result); Result.erase(std::unique(Result.begin(), Result.end()), Result.end()); return Result; } @@ -314,7 +314,7 @@ LegalValueTypes.insert(LegalValueTypes.end(), RC.VTs.begin(), RC.VTs.end()); // Remove duplicates. - llvm::sort(LegalValueTypes.begin(), LegalValueTypes.end()); + llvm::sort(LegalValueTypes); LegalValueTypes.erase(std::unique(LegalValueTypes.begin(), LegalValueTypes.end()), LegalValueTypes.end()); @@ -513,7 +513,7 @@ if (isTarget == TargetOnly) Intrinsics.push_back(CodeGenIntrinsic(Defs[I])); } - llvm::sort(Intrinsics.begin(), Intrinsics.end(), + llvm::sort(Intrinsics, [](const CodeGenIntrinsic &LHS, const CodeGenIntrinsic &RHS) { return std::tie(LHS.TargetPrefix, LHS.Name) < std::tie(RHS.TargetPrefix, RHS.Name); @@ -709,6 +709,6 @@ Properties = parseSDPatternOperatorProperties(R); // Sort the argument attributes for later benefit. - llvm::sort(ArgumentAttributes.begin(), ArgumentAttributes.end()); + llvm::sort(ArgumentAttributes); } Index: utils/TableGen/GlobalISelEmitter.cpp =================================================================== --- utils/TableGen/GlobalISelEmitter.cpp +++ utils/TableGen/GlobalISelEmitter.cpp @@ -2613,7 +2613,7 @@ std::vector MergeInsnIDs; for (const auto &IDMatcherPair : Rule.defined_insn_vars()) MergeInsnIDs.push_back(IDMatcherPair.second); - llvm::sort(MergeInsnIDs.begin(), MergeInsnIDs.end()); + llvm::sort(MergeInsnIDs); for (const auto &MergeInsnID : MergeInsnIDs) Table << MatchTable::IntValue(MergeInsnID); Table << MatchTable::NamedValue("GIU_MergeMemOperands_EndOfList") @@ -2812,7 +2812,7 @@ InsnIDs.push_back(Pair.second); } - llvm::sort(InsnIDs.begin(), InsnIDs.end()); + llvm::sort(InsnIDs); for (const auto &InsnID : InsnIDs) { // Reject the difficult cases until we have a more accurate check. @@ -4288,11 +4288,11 @@ std::vector ComplexPredicates = RK.getAllDerivedDefinitions("GIComplexOperandMatcher"); - llvm::sort(ComplexPredicates.begin(), ComplexPredicates.end(), orderByName); + llvm::sort(ComplexPredicates, orderByName); std::vector CustomRendererFns = RK.getAllDerivedDefinitions("GICustomOperandRenderer"); - llvm::sort(CustomRendererFns.begin(), CustomRendererFns.end(), orderByName); + llvm::sort(CustomRendererFns, orderByName); unsigned MaxTemporaries = 0; for (const auto &Rule : Rules) @@ -4371,7 +4371,7 @@ std::vector TypeObjects; for (const auto &Ty : KnownTypes) TypeObjects.push_back(Ty); - llvm::sort(TypeObjects.begin(), TypeObjects.end()); + llvm::sort(TypeObjects); OS << "// LLT Objects.\n" << "enum {\n"; for (const auto &TypeObject : TypeObjects) { Index: utils/TableGen/InfoByHwMode.cpp =================================================================== --- utils/TableGen/InfoByHwMode.cpp +++ utils/TableGen/InfoByHwMode.cpp @@ -84,7 +84,7 @@ std::vector Pairs; for (const auto &P : Map) Pairs.push_back(&P); - llvm::sort(Pairs.begin(), Pairs.end(), deref>()); + llvm::sort(Pairs, deref>()); OS << '{'; for (unsigned i = 0, e = Pairs.size(); i != e; ++i) { @@ -176,7 +176,7 @@ std::vector Pairs; for (const auto &P : Map) Pairs.push_back(&P); - llvm::sort(Pairs.begin(), Pairs.end(), deref>()); + llvm::sort(Pairs, deref>()); OS << '{'; for (unsigned i = 0, e = Pairs.size(); i != e; ++i) { Index: utils/TableGen/SubtargetEmitter.cpp =================================================================== --- utils/TableGen/SubtargetEmitter.cpp +++ utils/TableGen/SubtargetEmitter.cpp @@ -140,7 +140,7 @@ // Get all records of class and sort std::vector DefList = Records.getAllDerivedDefinitions("SubtargetFeature"); - llvm::sort(DefList.begin(), DefList.end(), LessRecord()); + llvm::sort(DefList, LessRecord()); unsigned N = DefList.size(); if (N == 0) @@ -179,7 +179,7 @@ if (FeatureList.empty()) return 0; - llvm::sort(FeatureList.begin(), FeatureList.end(), LessRecordFieldName()); + llvm::sort(FeatureList, LessRecordFieldName()); // Begin feature table OS << "// Sorted (by key) array of values for CPU features.\n" @@ -229,7 +229,7 @@ // Gather and sort processor information std::vector ProcessorList = Records.getAllDerivedDefinitions("Processor"); - llvm::sort(ProcessorList.begin(), ProcessorList.end(), LessRecordFieldName()); + llvm::sort(ProcessorList, LessRecordFieldName()); // Begin processor table OS << "// Sorted (by key) array of values for CPU subtype.\n" @@ -1182,7 +1182,7 @@ WriteIDs.push_back(SchedModels.getSchedRWIdx(VW, /*IsRead=*/false)); } } - llvm::sort(WriteIDs.begin(), WriteIDs.end()); + llvm::sort(WriteIDs); for(unsigned W : WriteIDs) { MCReadAdvanceEntry RAEntry; RAEntry.UseIdx = UseIdx; @@ -1200,7 +1200,7 @@ // compression. // // WritePrecRes entries are sorted by ProcResIdx. - llvm::sort(WriteProcResources.begin(), WriteProcResources.end(), + llvm::sort(WriteProcResources, LessWriteProcResources()); SCDesc.NumWriteProcResEntries = WriteProcResources.size(); @@ -1413,7 +1413,7 @@ // Gather and sort processor information std::vector ProcessorList = Records.getAllDerivedDefinitions("Processor"); - llvm::sort(ProcessorList.begin(), ProcessorList.end(), LessRecordFieldName()); + llvm::sort(ProcessorList, LessRecordFieldName()); // Begin processor table OS << "\n"; @@ -1479,7 +1479,7 @@ // stream. std::vector Prologs = Records.getAllDerivedDefinitions("PredicateProlog"); - llvm::sort(Prologs.begin(), Prologs.end(), LessRecord()); + llvm::sort(Prologs, LessRecord()); for (Record *P : Prologs) Stream << P->getValueAsString("Code") << '\n'; @@ -1717,7 +1717,7 @@ unsigned NumProcs) { std::vector Features = Records.getAllDerivedDefinitions("SubtargetFeature"); - llvm::sort(Features.begin(), Features.end(), LessRecord()); + llvm::sort(Features, LessRecord()); OS << "// ParseSubtargetFeatures - Parses features string setting specified\n" << "// subtarget options.\n"