Skip to content

Commit 81e9c90

Browse files
[llvm] Use llvm::is_contained (NFC)
1 parent 90ae538 commit 81e9c90

File tree

8 files changed

+12
-21
lines changed

8 files changed

+12
-21
lines changed

llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,7 @@ class DWARFContext : public DIContext {
373373
return {2, 4, 8};
374374
}
375375
static bool isAddressSizeSupported(unsigned AddressSize) {
376-
return llvm::any_of(getSupportedAddressSizes(),
377-
[=](auto Elem) { return Elem == AddressSize; });
376+
return llvm::is_contained(getSupportedAddressSizes(), AddressSize);
378377
}
379378

380379
std::shared_ptr<DWARFContext> getDWOContext(StringRef AbsolutePath);

llvm/include/llvm/Support/CommandLine.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,7 @@ class Option {
316316
}
317317

318318
bool isInAllSubCommands() const {
319-
return any_of(Subs, [](const SubCommand *SC) {
320-
return SC == &*AllSubCommands;
321-
});
319+
return llvm::is_contained(Subs, &*AllSubCommands);
322320
}
323321

324322
//-------------------------------------------------------------------------===

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6123,7 +6123,7 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
61236123
if (Values.empty())
61246124
return;
61256125

6126-
if (std::count(Values.begin(), Values.end(), nullptr))
6126+
if (llvm::is_contained(Values, nullptr))
61276127
return;
61286128

61296129
bool IsVariadic = DI.hasArgList();

llvm/lib/IR/Assumptions.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ bool hasAssumption(const Attribute &A,
2525
SmallVector<StringRef, 8> Strings;
2626
A.getValueAsString().split(Strings, ",");
2727

28-
return llvm::any_of(Strings, [=](StringRef Assumption) {
29-
return Assumption == AssumptionStr;
30-
});
28+
return llvm::is_contained(Strings, AssumptionStr);
3129
}
3230
} // namespace
3331

llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ static bool shouldUseFrameHelper(MachineBasicBlock &MBB,
363363
int InstCount = RegCount / 2;
364364

365365
// Do not use a helper call when not saving LR.
366-
if (std::find(Regs.begin(), Regs.end(), AArch64::LR) == Regs.end())
366+
if (!llvm::is_contained(Regs, AArch64::LR))
367367
return false;
368368

369369
switch (Type) {

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52940,13 +52940,13 @@ static bool matchAsm(StringRef S, ArrayRef<const char *> Pieces) {
5294052940
static bool clobbersFlagRegisters(const SmallVector<StringRef, 4> &AsmPieces) {
5294152941

5294252942
if (AsmPieces.size() == 3 || AsmPieces.size() == 4) {
52943-
if (std::count(AsmPieces.begin(), AsmPieces.end(), "~{cc}") &&
52944-
std::count(AsmPieces.begin(), AsmPieces.end(), "~{flags}") &&
52945-
std::count(AsmPieces.begin(), AsmPieces.end(), "~{fpsr}")) {
52943+
if (llvm::is_contained(AsmPieces, "~{cc}") &&
52944+
llvm::is_contained(AsmPieces, "~{flags}") &&
52945+
llvm::is_contained(AsmPieces, "~{fpsr}")) {
5294652946

5294752947
if (AsmPieces.size() == 3)
5294852948
return true;
52949-
else if (std::count(AsmPieces.begin(), AsmPieces.end(), "~{dirflag}"))
52949+
else if (llvm::is_contained(AsmPieces, "~{dirflag}"))
5295052950
return true;
5295152951
}
5295252952
}

llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,9 +858,7 @@ bool llvm::UnrollRuntimeLoopRemainder(
858858
}
859859
#if defined(EXPENSIVE_CHECKS) && !defined(NDEBUG)
860860
for (BasicBlock *SuccBB : successors(BB)) {
861-
assert(!(any_of(OtherExits,
862-
[SuccBB](BasicBlock *EB) { return EB == SuccBB; }) ||
863-
SuccBB == LatchExit) &&
861+
assert(!(llvm::is_contained(OtherExits, SuccBB) || SuccBB == LatchExit) &&
864862
"Breaks the definition of dedicated exits!");
865863
}
866864
#endif

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4292,8 +4292,7 @@ void InnerLoopVectorizer::fixFirstOrderRecurrence(VPWidenPHIRecipe *PhiR,
42924292
// and thus no phis which needed updated.
42934293
if (!Cost->requiresScalarEpilogue(VF))
42944294
for (PHINode &LCSSAPhi : LoopExitBlock->phis())
4295-
if (any_of(LCSSAPhi.incoming_values(),
4296-
[Phi](Value *V) { return V == Phi; }))
4295+
if (llvm::is_contained(LCSSAPhi.incoming_values(), Phi))
42974296
LCSSAPhi.addIncoming(ExtractForPhiUsedOutsideLoop, LoopMiddleBlock);
42984297
}
42994298

@@ -4451,8 +4450,7 @@ void InnerLoopVectorizer::fixReduction(VPReductionPHIRecipe *PhiR,
44514450
// fixFirstOrderRecurrence for a more complete explaination of the logic.
44524451
if (!Cost->requiresScalarEpilogue(VF))
44534452
for (PHINode &LCSSAPhi : LoopExitBlock->phis())
4454-
if (any_of(LCSSAPhi.incoming_values(),
4455-
[LoopExitInst](Value *V) { return V == LoopExitInst; }))
4453+
if (llvm::is_contained(LCSSAPhi.incoming_values(), LoopExitInst))
44564454
LCSSAPhi.addIncoming(ReducedPartRdx, LoopMiddleBlock);
44574455

44584456
// Fix the scalar loop reduction variable with the incoming reduction sum

0 commit comments

Comments
 (0)