Skip to content

Commit fab2bb8

Browse files
authored
Add llvm::min/max_element and use it in llvm/ and mlir/ directories. (#84678)
For some reason this was missing from STLExtras.
1 parent 6bec4fc commit fab2bb8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+111
-119
lines changed

llvm/include/llvm/ADT/STLExtras.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,6 +1971,22 @@ auto upper_bound(R &&Range, T &&Value, Compare C) {
19711971
std::forward<T>(Value), C);
19721972
}
19731973

1974+
template <typename R> auto min_element(R &&Range) {
1975+
return std::min_element(adl_begin(Range), adl_end(Range));
1976+
}
1977+
1978+
template <typename R, typename Compare> auto min_element(R &&Range, Compare C) {
1979+
return std::min_element(adl_begin(Range), adl_end(Range), C);
1980+
}
1981+
1982+
template <typename R> auto max_element(R &&Range) {
1983+
return std::max_element(adl_begin(Range), adl_end(Range));
1984+
}
1985+
1986+
template <typename R, typename Compare> auto max_element(R &&Range, Compare C) {
1987+
return std::max_element(adl_begin(Range), adl_end(Range), C);
1988+
}
1989+
19741990
template <typename R>
19751991
void stable_sort(R &&Range) {
19761992
std::stable_sort(adl_begin(Range), adl_end(Range));

llvm/include/llvm/CodeGen/RegAllocPBQP.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,8 @@ class RegAllocSolverImpl {
462462
NodeStack.push_back(NId);
463463
G.disconnectAllNeighborsFromNode(NId);
464464
} else if (!NotProvablyAllocatableNodes.empty()) {
465-
NodeSet::iterator NItr =
466-
std::min_element(NotProvablyAllocatableNodes.begin(),
467-
NotProvablyAllocatableNodes.end(),
468-
SpillCostComparator(G));
465+
NodeSet::iterator NItr = llvm::min_element(NotProvablyAllocatableNodes,
466+
SpillCostComparator(G));
469467
NodeId NId = *NItr;
470468
NotProvablyAllocatableNodes.erase(NItr);
471469
NodeStack.push_back(NId);

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10839,10 +10839,9 @@ bool ScalarEvolution::isKnownViaInduction(ICmpInst::Predicate Pred,
1083910839
#endif
1084010840

1084110841
const Loop *MDL =
10842-
*std::max_element(LoopsUsed.begin(), LoopsUsed.end(),
10843-
[&](const Loop *L1, const Loop *L2) {
10844-
return DT.properlyDominates(L1->getHeader(), L2->getHeader());
10845-
});
10842+
*llvm::max_element(LoopsUsed, [&](const Loop *L1, const Loop *L2) {
10843+
return DT.properlyDominates(L1->getHeader(), L2->getHeader());
10844+
});
1084610845

1084710846
// Get init and post increment value for LHS.
1084810847
auto SplitLHS = SplitIntoInitAndPostInc(MDL, LHS);

llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ uint32_t PDBFile::getNumStreams() const {
8686
}
8787

8888
uint32_t PDBFile::getMaxStreamSize() const {
89-
return *std::max_element(ContainerLayout.StreamSizes.begin(),
90-
ContainerLayout.StreamSizes.end());
89+
return *llvm::max_element(ContainerLayout.StreamSizes);
9190
}
9291

9392
uint32_t PDBFile::getStreamByteSize(uint32_t StreamIndex) const {

llvm/lib/IR/DataLayout.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ Type *DataLayout::getSmallestLegalIntType(LLVMContext &C, unsigned Width) const
898898
}
899899

900900
unsigned DataLayout::getLargestLegalIntTypeSizeInBits() const {
901-
auto Max = std::max_element(LegalIntWidths.begin(), LegalIntWidths.end());
901+
auto Max = llvm::max_element(LegalIntWidths);
902902
return Max != LegalIntWidths.end() ? *Max : 0;
903903
}
904904

llvm/lib/ObjCopy/MachO/MachOWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ size_t MachOWriter::totalSize() const {
126126
}
127127

128128
if (!Ends.empty())
129-
return *std::max_element(Ends.begin(), Ends.end());
129+
return *llvm::max_element(Ends);
130130

131131
// Otherwise, we have only Mach header and load commands.
132132
return headerSize() + loadCommandsSize();

llvm/lib/ProfileData/GCOV.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ void Context::collectFunction(GCOVFunction &f, Summary &summary) {
703703
for (const GCOVBlock &b : f.blocksRange()) {
704704
if (b.lines.empty())
705705
continue;
706-
uint32_t maxLineNum = *std::max_element(b.lines.begin(), b.lines.end());
706+
uint32_t maxLineNum = *llvm::max_element(b.lines);
707707
if (maxLineNum >= si.lines.size())
708708
si.lines.resize(maxLineNum + 1);
709709
for (uint32_t lineNum : b.lines) {

llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ bool SVEIntrinsicOpts::coalescePTrueIntrinsicCalls(
138138
return false;
139139

140140
// Find the ptrue with the most lanes.
141-
auto *MostEncompassingPTrue = *std::max_element(
142-
PTrues.begin(), PTrues.end(), [](auto *PTrue1, auto *PTrue2) {
141+
auto *MostEncompassingPTrue =
142+
*llvm::max_element(PTrues, [](auto *PTrue1, auto *PTrue2) {
143143
auto *PTrue1VTy = cast<ScalableVectorType>(PTrue1->getType());
144144
auto *PTrue2VTy = cast<ScalableVectorType>(PTrue2->getType());
145145
return PTrue1VTy->getElementCount().getKnownMinValue() <

llvm/lib/Target/AMDGPU/GCNILPSched.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,11 @@ GCNILPScheduler::schedule(ArrayRef<const SUnit*> BotRoots,
313313
Schedule.reserve(SUnits.size());
314314
while (true) {
315315
if (AvailQueue.empty() && !PendingQueue.empty()) {
316-
auto EarliestSU = std::min_element(
317-
PendingQueue.begin(), PendingQueue.end(),
318-
[=](const Candidate& C1, const Candidate& C2) {
319-
return C1.SU->getHeight() < C2.SU->getHeight();
320-
})->SU;
316+
auto EarliestSU =
317+
llvm::min_element(PendingQueue, [=](const Candidate &C1,
318+
const Candidate &C2) {
319+
return C1.SU->getHeight() < C2.SU->getHeight();
320+
})->SU;
321321
advanceToCycle(std::max(CurCycle + 1, EarliestSU->getHeight()));
322322
}
323323
if (AvailQueue.empty())

llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -973,9 +973,8 @@ bool SIFixSGPRCopies::needToBeConvertedToVALU(V2SCopyInfo *Info) {
973973
Info->Score = 0;
974974
return true;
975975
}
976-
Info->Siblings = SiblingPenalty[*std::max_element(
977-
Info->SChain.begin(), Info->SChain.end(),
978-
[&](MachineInstr *A, MachineInstr *B) -> bool {
976+
Info->Siblings = SiblingPenalty[*llvm::max_element(
977+
Info->SChain, [&](MachineInstr *A, MachineInstr *B) -> bool {
979978
return SiblingPenalty[A].size() < SiblingPenalty[B].size();
980979
})];
981980
Info->Siblings.remove_if([&](unsigned ID) { return ID == Info->ID; });

llvm/lib/Target/AMDGPU/SIMachineScheduler.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -904,10 +904,8 @@ void SIScheduleBlockCreator::colorEndsAccordingToDependencies() {
904904
CurrentTopDownReservedDependencyColoring.size() == DAGSize);
905905
// If there is no reserved block at all, do nothing. We don't want
906906
// everything in one block.
907-
if (*std::max_element(CurrentBottomUpReservedDependencyColoring.begin(),
908-
CurrentBottomUpReservedDependencyColoring.end()) == 0 &&
909-
*std::max_element(CurrentTopDownReservedDependencyColoring.begin(),
910-
CurrentTopDownReservedDependencyColoring.end()) == 0)
907+
if (*llvm::max_element(CurrentBottomUpReservedDependencyColoring) == 0 &&
908+
*llvm::max_element(CurrentTopDownReservedDependencyColoring) == 0)
911909
return;
912910

913911
for (unsigned SUNum : DAG->BottomUpIndex2SU) {

llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ void HexagonCommonGEP::common() {
593593
using ProjMap = std::map<const NodeSet *, GepNode *>;
594594
ProjMap PM;
595595
for (const NodeSet &S : EqRel) {
596-
GepNode *Min = *std::min_element(S.begin(), S.end(), NodeOrder);
596+
GepNode *Min = *llvm::min_element(S, NodeOrder);
597597
std::pair<ProjMap::iterator,bool> Ins = PM.insert(std::make_pair(&S, Min));
598598
(void)Ins;
599599
assert(Ins.second && "Cannot add minimal element");

llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,11 +1388,10 @@ void HCE::assignInits(const ExtRoot &ER, unsigned Begin, unsigned End,
13881388
break;
13891389

13901390
// Find the best candidate with respect to the number of extenders covered.
1391-
auto BestIt = std::max_element(Counts.begin(), Counts.end(),
1392-
[](const CMap::value_type &A, const CMap::value_type &B) {
1393-
return A.second < B.second ||
1394-
(A.second == B.second && A < B);
1395-
});
1391+
auto BestIt = llvm::max_element(
1392+
Counts, [](const CMap::value_type &A, const CMap::value_type &B) {
1393+
return A.second < B.second || (A.second == B.second && A < B);
1394+
});
13961395
int32_t Best = BestIt->first;
13971396
ExtValue BestV(ER, Best);
13981397
for (RangeTree::Node *N : Tree.nodesWith(Best)) {

llvm/lib/Target/Hexagon/HexagonGenInsert.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,7 @@ void HexagonGenInsert::selectCandidates() {
13141314
// element found is adequate, we will put it back on the list, other-
13151315
// wise the list will remain empty, and the entry for this register
13161316
// will be removed (i.e. this register will not be replaced by insert).
1317-
IFListType::iterator MinI = std::min_element(LL.begin(), LL.end(), IFO);
1317+
IFListType::iterator MinI = llvm::min_element(LL, IFO);
13181318
assert(MinI != LL.end());
13191319
IFRecordWithRegSet M = *MinI;
13201320
LL.clear();

llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,9 +1411,9 @@ auto AlignVectors::realignGroup(const MoveGroup &Move) const -> bool {
14111411
// Return the element with the maximum alignment from Range,
14121412
// where GetValue obtains the value to compare from an element.
14131413
auto getMaxOf = [](auto Range, auto GetValue) {
1414-
return *std::max_element(
1415-
Range.begin(), Range.end(),
1416-
[&GetValue](auto &A, auto &B) { return GetValue(A) < GetValue(B); });
1414+
return *llvm::max_element(Range, [&GetValue](auto &A, auto &B) {
1415+
return GetValue(A) < GetValue(B);
1416+
});
14171417
};
14181418

14191419
const AddrList &BaseInfos = AddrGroups.at(Move.Base);

llvm/lib/Transforms/Scalar/GVNSink.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,8 +655,7 @@ GVNSink::analyzeInstructionForSinking(LockstepReverseIterator &LRI,
655655
return std::nullopt;
656656
VNums[N]++;
657657
}
658-
unsigned VNumToSink =
659-
std::max_element(VNums.begin(), VNums.end(), llvm::less_second())->first;
658+
unsigned VNumToSink = llvm::max_element(VNums, llvm::less_second())->first;
660659

661660
if (VNums[VNumToSink] == 1)
662661
// Can't sink anything!

llvm/lib/Transforms/Scalar/JumpThreading.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,7 @@ findMostPopularDest(BasicBlock *BB,
14881488

14891489
// Populate DestPopularity with the successors in the order they appear in the
14901490
// successor list. This way, we ensure determinism by iterating it in the
1491-
// same order in std::max_element below. We map nullptr to 0 so that we can
1491+
// same order in llvm::max_element below. We map nullptr to 0 so that we can
14921492
// return nullptr when PredToDestList contains nullptr only.
14931493
DestPopularity[nullptr] = 0;
14941494
for (auto *SuccBB : successors(BB))
@@ -1499,8 +1499,7 @@ findMostPopularDest(BasicBlock *BB,
14991499
DestPopularity[PredToDest.second]++;
15001500

15011501
// Find the most popular dest.
1502-
auto MostPopular = std::max_element(
1503-
DestPopularity.begin(), DestPopularity.end(), llvm::less_second());
1502+
auto MostPopular = llvm::max_element(DestPopularity, llvm::less_second());
15041503

15051504
// Okay, we have finally picked the most popular destination.
15061505
return MostPopular->first;
@@ -2553,8 +2552,7 @@ void JumpThreadingPass::updateBlockFreqAndEdgeWeight(BasicBlock *PredBB,
25532552
BBSuccFreq.push_back(SuccFreq.getFrequency());
25542553
}
25552554

2556-
uint64_t MaxBBSuccFreq =
2557-
*std::max_element(BBSuccFreq.begin(), BBSuccFreq.end());
2555+
uint64_t MaxBBSuccFreq = *llvm::max_element(BBSuccFreq);
25582556

25592557
SmallVector<BranchProbability, 4> BBSuccProbs;
25602558
if (MaxBBSuccFreq == 0)

llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -349,19 +349,20 @@ class LoadEliminationForLoop {
349349
// ld0.
350350

351351
LoadInst *LastLoad =
352-
std::max_element(Candidates.begin(), Candidates.end(),
353-
[&](const StoreToLoadForwardingCandidate &A,
354-
const StoreToLoadForwardingCandidate &B) {
355-
return getInstrIndex(A.Load) < getInstrIndex(B.Load);
356-
})
352+
llvm::max_element(Candidates,
353+
[&](const StoreToLoadForwardingCandidate &A,
354+
const StoreToLoadForwardingCandidate &B) {
355+
return getInstrIndex(A.Load) <
356+
getInstrIndex(B.Load);
357+
})
357358
->Load;
358359
StoreInst *FirstStore =
359-
std::min_element(Candidates.begin(), Candidates.end(),
360-
[&](const StoreToLoadForwardingCandidate &A,
361-
const StoreToLoadForwardingCandidate &B) {
362-
return getInstrIndex(A.Store) <
363-
getInstrIndex(B.Store);
364-
})
360+
llvm::min_element(Candidates,
361+
[&](const StoreToLoadForwardingCandidate &A,
362+
const StoreToLoadForwardingCandidate &B) {
363+
return getInstrIndex(A.Store) <
364+
getInstrIndex(B.Store);
365+
})
365366
->Store;
366367

367368
// We're looking for stores after the first forwarding store until the end

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ static void GetBranchWeights(Instruction *TI,
10841084

10851085
/// Keep halving the weights until all can fit in uint32_t.
10861086
static void FitWeights(MutableArrayRef<uint64_t> Weights) {
1087-
uint64_t Max = *std::max_element(Weights.begin(), Weights.end());
1087+
uint64_t Max = *llvm::max_element(Weights);
10881088
if (Max > UINT_MAX) {
10891089
unsigned Offset = 32 - llvm::countl_zero(Max);
10901090
for (uint64_t &I : Weights)

llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ bool Vectorizer::vectorizeChain(Chain &C) {
892892
// Loads get hoisted to the location of the first load in the chain. We may
893893
// also need to hoist the (transitive) operands of the loads.
894894
Builder.SetInsertPoint(
895-
std::min_element(C.begin(), C.end(), [](const auto &A, const auto &B) {
895+
llvm::min_element(C, [](const auto &A, const auto &B) {
896896
return A.Inst->comesBefore(B.Inst);
897897
})->Inst);
898898

@@ -944,10 +944,9 @@ bool Vectorizer::vectorizeChain(Chain &C) {
944944
reorder(VecInst);
945945
} else {
946946
// Stores get sunk to the location of the last store in the chain.
947-
Builder.SetInsertPoint(
948-
std::max_element(C.begin(), C.end(), [](auto &A, auto &B) {
949-
return A.Inst->comesBefore(B.Inst);
950-
})->Inst);
947+
Builder.SetInsertPoint(llvm::max_element(C, [](auto &A, auto &B) {
948+
return A.Inst->comesBefore(B.Inst);
949+
})->Inst);
951950

952951
// Build the vector to store.
953952
Value *Vec = PoisonValue::get(VecTy);

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10172,11 +10172,10 @@ BoUpSLP::isGatherShuffledSingleRegisterEntry(
1017210172
// No 2 source vectors with the same vector factor - just choose 2 with max
1017310173
// index.
1017410174
if (Entries.empty()) {
10175-
Entries.push_back(
10176-
*std::max_element(UsedTEs.front().begin(), UsedTEs.front().end(),
10177-
[](const TreeEntry *TE1, const TreeEntry *TE2) {
10178-
return TE1->Idx < TE2->Idx;
10179-
}));
10175+
Entries.push_back(*llvm::max_element(
10176+
UsedTEs.front(), [](const TreeEntry *TE1, const TreeEntry *TE2) {
10177+
return TE1->Idx < TE2->Idx;
10178+
}));
1018010179
Entries.push_back(SecondEntries.front());
1018110180
VF = std::max(Entries.front()->getVectorFactor(),
1018210181
Entries.back()->getVectorFactor());

llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ static double computeVariance(const SmallVector<int64_t, 4> &Values) {
5252
static int64_t findMin(const SmallVector<int64_t, 4> &Values) {
5353
if (Values.empty())
5454
return 0;
55-
return *std::min_element(Values.begin(), Values.end());
55+
return *llvm::min_element(Values);
5656
}
5757

5858
static int64_t findMax(const SmallVector<int64_t, 4> &Values) {
5959
if (Values.empty())
6060
return 0;
61-
return *std::max_element(Values.begin(), Values.end());
61+
return *llvm::max_element(Values);
6262
}
6363

6464
static int64_t findMean(const SmallVector<int64_t, 4> &Values) {

llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,10 @@ void DependencyGraph::getCriticalSequence(
270270
// To obtain the sequence of critical edges, we simply follow the chain of
271271
// critical predecessors starting from node N (field
272272
// DGNode::CriticalPredecessor).
273-
const auto It = std::max_element(
274-
Nodes.begin(), Nodes.end(),
275-
[](const DGNode &Lhs, const DGNode &Rhs) { return Lhs.Cost < Rhs.Cost; });
273+
const auto It =
274+
llvm::max_element(Nodes, [](const DGNode &Lhs, const DGNode &Rhs) {
275+
return Lhs.Cost < Rhs.Cost;
276+
});
276277
unsigned IID = std::distance(Nodes.begin(), It);
277278
Seq.resize(Nodes[IID].Depth);
278279
for (const DependencyEdge *&DE : llvm::reverse(Seq)) {

llvm/tools/llvm-mca/Views/SchedulerStatistics.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ void SchedulerStatistics::printSchedulerStats(raw_ostream &OS) const {
105105
OS << "[# issued], [# cycles]\n";
106106

107107
bool HasColors = OS.has_colors();
108-
const auto It =
109-
std::max_element(IssueWidthPerCycle.begin(), IssueWidthPerCycle.end());
108+
const auto It = llvm::max_element(IssueWidthPerCycle);
110109
for (const std::pair<const unsigned, unsigned> &Entry : IssueWidthPerCycle) {
111110
unsigned NumIssued = Entry.first;
112111
if (NumIssued == It->first && HasColors)

llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,8 +1070,7 @@ Error DumpOutputStyle::dumpStringTableFromPdb() {
10701070
if (IS->name_ids().empty())
10711071
P.formatLine("Empty");
10721072
else {
1073-
auto MaxID =
1074-
std::max_element(IS->name_ids().begin(), IS->name_ids().end());
1073+
auto MaxID = llvm::max_element(IS->name_ids(), IS->name_ids());
10751074
uint32_t Digits = NumDigits(*MaxID);
10761075

10771076
P.formatLine("{0} | {1}", fmt_align("ID", AlignStyle::Right, Digits),
@@ -1836,9 +1835,9 @@ Error DumpOutputStyle::dumpSectionContribs() {
18361835
class Visitor : public ISectionContribVisitor {
18371836
public:
18381837
Visitor(LinePrinter &P, ArrayRef<std::string> Names) : P(P), Names(Names) {
1839-
auto Max = std::max_element(
1840-
Names.begin(), Names.end(),
1841-
[](StringRef S1, StringRef S2) { return S1.size() < S2.size(); });
1838+
auto Max = llvm::max_element(Names, [](StringRef S1, StringRef S2) {
1839+
return S1.size() < S2.size();
1840+
});
18421841
MaxNameLen = (Max == Names.end() ? 0 : Max->size());
18431842
}
18441843
void visit(const SectionContrib &SC) override {

llvm/tools/llvm-pdbutil/MinimalTypeDumper.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ Error MinimalTypeDumpVisitor::visitKnownRecord(CVType &CVR,
308308
if (Indices.empty())
309309
return Error::success();
310310

311-
auto Max = std::max_element(Indices.begin(), Indices.end());
311+
auto Max = llvm::max_element(Indices);
312312
uint32_t W = NumDigits(Max->getIndex()) + 2;
313313

314314
for (auto I : Indices)
@@ -323,7 +323,7 @@ Error MinimalTypeDumpVisitor::visitKnownRecord(CVType &CVR,
323323
if (Indices.empty())
324324
return Error::success();
325325

326-
auto Max = std::max_element(Indices.begin(), Indices.end());
326+
auto Max = llvm::max_element(Indices);
327327
uint32_t W = NumDigits(Max->getIndex()) + 2;
328328

329329
for (auto I : Indices)
@@ -493,7 +493,7 @@ Error MinimalTypeDumpVisitor::visitKnownRecord(CVType &CVR,
493493
if (Indices.empty())
494494
return Error::success();
495495

496-
auto Max = std::max_element(Indices.begin(), Indices.end());
496+
auto Max = llvm::max_element(Indices);
497497
uint32_t W = NumDigits(Max->getIndex()) + 2;
498498

499499
for (auto I : Indices)

0 commit comments

Comments
 (0)