mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[llvm] Use llvm::stable_sort (NFC)
This commit is contained in:
parent
d84950767c
commit
70fe70920d
@ -140,10 +140,10 @@ void StackLayout::computeLayout() {
|
||||
|
||||
// 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);
|
||||
|
@ -326,7 +326,7 @@ bool HexagonShuffler::ValidResourceUsage(HexagonPacketSummary const &Summary) {
|
||||
}
|
||||
|
||||
// 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();
|
||||
@ -609,8 +609,7 @@ llvm::Optional<HexagonShuffler::HexagonPacket>
|
||||
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) {
|
||||
|
@ -554,7 +554,7 @@ static void getCodeExtractorArguments(
|
||||
|
||||
// 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
|
||||
|
@ -1076,7 +1076,7 @@ AllocaSlices::AllocaSlices(const DataLayout &DL, AllocaInst &AI)
|
||||
|
||||
// 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)
|
||||
|
@ -159,8 +159,7 @@ void DAGISelEmitter::run(raw_ostream &OS) {
|
||||
|
||||
// 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");
|
||||
|
@ -5480,15 +5480,13 @@ GlobalISelEmitter::buildMatchTable(MutableArrayRef<RuleMatcher> Rules,
|
||||
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();
|
||||
@ -6088,11 +6086,10 @@ void SwitchMatcher::finalize() {
|
||||
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();
|
||||
|
@ -359,8 +359,7 @@ using DwarfRegNumsVecTy = std::vector<DwarfRegNumsMapPair>;
|
||||
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) {
|
||||
|
@ -338,11 +338,10 @@ void SearchableTableEmitter::emitLookupFunction(const GenericTable &Table,
|
||||
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) {
|
||||
@ -610,11 +609,11 @@ void SearchableTableEmitter::collectEnumEntries(
|
||||
}
|
||||
|
||||
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;
|
||||
@ -739,10 +738,9 @@ void SearchableTableEmitter::run(raw_ostream &OS) {
|
||||
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()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user