Skip to content

Commit ff78648

Browse files
[llvm] Use llvm::find_if (NFC) (#140412)
1 parent 1a40edf commit ff78648

File tree

6 files changed

+17
-19
lines changed

6 files changed

+17
-19
lines changed

llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace detail {
5656
template <typename Container, typename Predicate>
5757
typename std::remove_reference_t<Container>::iterator
5858
find_unique(Container &&container, Predicate &&pred) {
59-
auto first = std::find_if(container.begin(), container.end(), pred);
59+
auto first = llvm::find_if(container, pred);
6060
if (first == container.end())
6161
return first;
6262
auto second = std::find_if(std::next(first), container.end(), pred);

llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -801,9 +801,8 @@ void LVBinaryReader::processLines(LVLines *DebugLines,
801801

802802
// Find the indexes for the lines whose address is zero.
803803
std::vector<size_t> AddressZero;
804-
LVLines::iterator It =
805-
std::find_if(std::begin(*DebugLines), std::end(*DebugLines),
806-
[](LVLine *Line) { return !Line->getAddress(); });
804+
LVLines::iterator It = llvm::find_if(
805+
*DebugLines, [](LVLine *Line) { return !Line->getAddress(); });
807806
while (It != std::end(*DebugLines)) {
808807
AddressZero.emplace_back(std::distance(std::begin(*DebugLines), It));
809808
It = std::find_if(std::next(It), std::end(*DebugLines),
@@ -930,8 +929,8 @@ void LVBinaryReader::includeInlineeLines(LVSectionIndex SectionIndex,
930929
if (InlineeLines->size()) {
931930
// First address of inlinee code.
932931
uint64_t InlineeStart = (InlineeLines->front())->getAddress();
933-
LVLines::iterator Iter = std::find_if(
934-
CULines.begin(), CULines.end(), [&](LVLine *Item) -> bool {
932+
LVLines::iterator Iter =
933+
llvm::find_if(CULines, [&](LVLine *Item) -> bool {
935934
return Item->getAddress() == InlineeStart;
936935
});
937936
if (Iter != CULines.end()) {

llvm/lib/Target/AArch64/AArch64FrameLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3389,11 +3389,11 @@ bool AArch64FrameLowering::restoreCalleeSavedRegisters(
33893389

33903390
// For performance reasons restore SVE register in increasing order
33913391
auto IsPPR = [](const RegPairInfo &c) { return c.Type == RegPairInfo::PPR; };
3392-
auto PPRBegin = std::find_if(RegPairs.begin(), RegPairs.end(), IsPPR);
3392+
auto PPRBegin = llvm::find_if(RegPairs, IsPPR);
33933393
auto PPREnd = std::find_if_not(PPRBegin, RegPairs.end(), IsPPR);
33943394
std::reverse(PPRBegin, PPREnd);
33953395
auto IsZPR = [](const RegPairInfo &c) { return c.Type == RegPairInfo::ZPR; };
3396-
auto ZPRBegin = std::find_if(RegPairs.begin(), RegPairs.end(), IsZPR);
3396+
auto ZPRBegin = llvm::find_if(RegPairs, IsZPR);
33973397
auto ZPREnd = std::find_if_not(ZPRBegin, RegPairs.end(), IsZPR);
33983398
std::reverse(ZPRBegin, ZPREnd);
33993399

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3720,9 +3720,10 @@ SDValue SITargetLowering::LowerCall(CallLoweringInfo &CLI,
37203720
// followed by the flags and any other arguments with special meanings.
37213721
// Pop them out of CLI.Outs and CLI.OutVals before we do any processing so
37223722
// we don't treat them like the "real" arguments.
3723-
auto RequestedExecIt = std::find_if(
3724-
CLI.Outs.begin(), CLI.Outs.end(),
3725-
[](const ISD::OutputArg &Arg) { return Arg.OrigArgIndex == 2; });
3723+
auto RequestedExecIt =
3724+
llvm::find_if(CLI.Outs, [](const ISD::OutputArg &Arg) {
3725+
return Arg.OrigArgIndex == 2;
3726+
});
37263727
assert(RequestedExecIt != CLI.Outs.end() && "No node for EXEC");
37273728

37283729
size_t SpecialArgsBeginIdx = RequestedExecIt - CLI.Outs.begin();

llvm/lib/Target/Hexagon/HexagonOptAddrMode.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,9 @@ bool HexagonOptAddrMode::findFirstReachedInst(
484484
for (auto &InstIter : *CurrentMBB) {
485485
// If the instruction is an Addi and is in the AddiList
486486
if (InstIter.getOpcode() == Hexagon::A2_addi) {
487-
auto Iter = std::find_if(
488-
AddiList.begin(), AddiList.end(), [&InstIter](const auto &SUPair) {
489-
return SUPair.first.Addr->getCode() == &InstIter;
490-
});
487+
auto Iter = llvm::find_if(AddiList, [&InstIter](const auto &SUPair) {
488+
return SUPair.first.Addr->getCode() == &InstIter;
489+
});
491490
if (Iter != AddiList.end()) {
492491
UseSN = Iter->first;
493492
return true;

llvm/unittests/XRay/GraphTest.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ template <typename T> void graphVertexTester(T &G) {
7373
EXPECT_EQ(1u, G.count(u));
7474
EXPECT_EQ(VA[u], EVV->VA);
7575
EXPECT_NE(G.vertices().end(),
76-
std::find_if(G.vertices().begin(), G.vertices().end(),
77-
[&](const VVT &VV) { return VV.first == u; }));
76+
llvm::find_if(G.vertices(),
77+
[&](const VVT &VV) { return VV.first == u; }));
7878
consumeError(EVV.takeError());
7979
}
8080

@@ -98,8 +98,7 @@ template <typename T> void graphEdgeTester(T &G) {
9898
EXPECT_EQ(VA[u.first] * VA[u.second] * ((u.first > u.second) ? 2 : 1),
9999
EEV->EA);
100100
auto Pred = [&](const EVT &EV) { return EV.first == u; };
101-
EXPECT_NE(G.edges().end(),
102-
std::find_if(G.edges().begin(), G.edges().end(), Pred));
101+
EXPECT_NE(G.edges().end(), llvm::find_if(G.edges(), Pred));
103102
consumeError(EEV.takeError());
104103
}
105104

0 commit comments

Comments
 (0)