// Sort objects by size (largest first) to reduce fragmentation.
if (StackObjects.size() > 2)
- std::stable_sort(StackObjects.begin() + 1, StackObjects.end(),
- [](const StackObject &a, const StackObject &b) {
- return a.Size > b.Size;
- });
+ llvm::stable_sort(drop_begin(StackObjects, 1),
+ [](const StackObject &a, const StackObject &b) {
+ return a.Size > b.Size;
+ });
for (auto &Obj : StackObjects)
layoutObject(Obj);
}
// Verify the CVI slot subscriptions.
- std::stable_sort(begin(), end(), HexagonInstr::lessCVI);
+ llvm::stable_sort(*this, HexagonInstr::lessCVI);
// create vector of hvx instructions to check
HVXInstsT hvxInsts;
hvxInsts.clear();
HexagonShuffler::tryAuction(HexagonPacketSummary const &Summary) const {
HexagonPacket PacketResult = Packet;
HexagonUnitAuction AuctionCore(Summary.ReservedSlotMask);
- std::stable_sort(PacketResult.begin(), PacketResult.end(),
- HexagonInstr::lessCore);
+ llvm::stable_sort(PacketResult, HexagonInstr::lessCore);
const bool ValidSlots =
llvm::all_of(insts(PacketResult), [&AuctionCore](HexagonInstr const &I) {
// Sort the GVNs, since we now have constants included in the \ref InputGVNs
// we need to make sure they are in a deterministic order.
- stable_sort(InputGVNs.begin(), InputGVNs.end());
+ stable_sort(InputGVNs);
}
/// Look over the inputs and map each input argument to an argument in the
// Sort the uses. This arranges for the offsets to be in ascending order,
// and the sizes to be in descending order.
- std::stable_sort(Slices.begin(), Slices.end());
+ llvm::stable_sort(Slices);
}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
// We want to process the matches in order of minimal cost. Sort the patterns
// so the least cost one is at the start.
- std::stable_sort(Patterns.begin(), Patterns.end(),
- PatternSortingPredicate(CGP));
+ llvm::stable_sort(Patterns, PatternSortingPredicate(CGP));
// Convert each variant of each pattern into a Matcher.
Records.startTimer("Convert to matchers");
OpcodeOrder[Opcode] = CurrentOrdering++;
}
- std::stable_sort(InputRules.begin(), InputRules.end(),
- [&OpcodeOrder](const Matcher *A, const Matcher *B) {
- auto *L = static_cast<const RuleMatcher *>(A);
- auto *R = static_cast<const RuleMatcher *>(B);
- return std::make_tuple(OpcodeOrder[L->getOpcode()],
- L->getNumOperands()) <
- std::make_tuple(OpcodeOrder[R->getOpcode()],
- R->getNumOperands());
- });
+ llvm::stable_sort(InputRules, [&OpcodeOrder](const Matcher *A,
+ const Matcher *B) {
+ auto *L = static_cast<const RuleMatcher *>(A);
+ auto *R = static_cast<const RuleMatcher *>(B);
+ return std::make_tuple(OpcodeOrder[L->getOpcode()], L->getNumOperands()) <
+ std::make_tuple(OpcodeOrder[R->getOpcode()], R->getNumOperands());
+ });
for (Matcher *Rule : InputRules)
Rule->optimize();
if (empty())
return;
- std::stable_sort(Matchers.begin(), Matchers.end(),
- [](const Matcher *L, const Matcher *R) {
- return L->getFirstCondition().getValue() <
- R->getFirstCondition().getValue();
- });
+ llvm::stable_sort(Matchers, [](const Matcher *L, const Matcher *R) {
+ return L->getFirstCondition().getValue() <
+ R->getFirstCondition().getValue();
+ });
Condition = Matchers[0]->popFirstCondition();
for (unsigned I = 1, E = Values.size(); I < E; ++I)
Matchers[I]->popFirstCondition();
static void finalizeDwarfRegNumsKeys(DwarfRegNumsVecTy &DwarfRegNums) {
// Sort and unique to get a map-like vector. We want the last assignment to
// match previous behaviour.
- std::stable_sort(DwarfRegNums.begin(), DwarfRegNums.end(),
- on_first<LessRecordRegister>());
+ llvm::stable_sort(DwarfRegNums, on_first<LessRecordRegister>());
// Warn about duplicate assignments.
const Record *LastSeenReg = nullptr;
for (const auto &X : DwarfRegNums) {
for (unsigned i = 0; i < Table.Entries.size(); ++i)
Entries.emplace_back(Table.Entries[i], i);
- std::stable_sort(Entries.begin(), Entries.end(),
- [&](const std::pair<Record *, unsigned> &LHS,
- const std::pair<Record *, unsigned> &RHS) {
- return compareBy(LHS.first, RHS.first, Index);
- });
+ llvm::stable_sort(Entries, [&](const std::pair<Record *, unsigned> &LHS,
+ const std::pair<Record *, unsigned> &RHS) {
+ return compareBy(LHS.first, RHS.first, Index);
+ });
IndexRowsStorage.reserve(Entries.size());
for (const auto &Entry : Entries) {
}
if (ValueField.empty()) {
- std::stable_sort(Enum.Entries.begin(), Enum.Entries.end(),
- [](const std::unique_ptr<GenericEnum::Entry> &LHS,
- const std::unique_ptr<GenericEnum::Entry> &RHS) {
- return LHS->first < RHS->first;
- });
+ llvm::stable_sort(Enum.Entries,
+ [](const std::unique_ptr<GenericEnum::Entry> &LHS,
+ const std::unique_ptr<GenericEnum::Entry> &RHS) {
+ return LHS->first < RHS->first;
+ });
for (size_t i = 0; i < Enum.Entries.size(); ++i)
Enum.Entries[i]->second = i;
TableRec->getValueAsListOfStrings("PrimaryKey"),
TableRec->getValueAsBit("PrimaryKeyEarlyOut"));
- std::stable_sort(Table->Entries.begin(), Table->Entries.end(),
- [&](Record *LHS, Record *RHS) {
- return compareBy(LHS, RHS, *Table->PrimaryKey);
- });
+ llvm::stable_sort(Table->Entries, [&](Record *LHS, Record *RHS) {
+ return compareBy(LHS, RHS, *Table->PrimaryKey);
+ });
}
TableMap.insert(std::make_pair(TableRec, Table.get()));