[llvm] Use llvm::is_contained (NFC)

This commit is contained in:
Kazu Hirata 2021-10-14 22:44:08 -07:00
parent 90ae538cab
commit 81e9c90686
8 changed files with 12 additions and 21 deletions

View File

@ -373,8 +373,7 @@ public:
return {2, 4, 8};
}
static bool isAddressSizeSupported(unsigned AddressSize) {
return llvm::any_of(getSupportedAddressSizes(),
[=](auto Elem) { return Elem == AddressSize; });
return llvm::is_contained(getSupportedAddressSizes(), AddressSize);
}
std::shared_ptr<DWARFContext> getDWOContext(StringRef AbsolutePath);

View File

@ -316,9 +316,7 @@ public:
}
bool isInAllSubCommands() const {
return any_of(Subs, [](const SubCommand *SC) {
return SC == &*AllSubCommands;
});
return llvm::is_contained(Subs, &*AllSubCommands);
}
//-------------------------------------------------------------------------===

View File

@ -6123,7 +6123,7 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
if (Values.empty())
return;
if (std::count(Values.begin(), Values.end(), nullptr))
if (llvm::is_contained(Values, nullptr))
return;
bool IsVariadic = DI.hasArgList();

View File

@ -25,9 +25,7 @@ bool hasAssumption(const Attribute &A,
SmallVector<StringRef, 8> Strings;
A.getValueAsString().split(Strings, ",");
return llvm::any_of(Strings, [=](StringRef Assumption) {
return Assumption == AssumptionStr;
});
return llvm::is_contained(Strings, AssumptionStr);
}
} // namespace

View File

@ -363,7 +363,7 @@ static bool shouldUseFrameHelper(MachineBasicBlock &MBB,
int InstCount = RegCount / 2;
// Do not use a helper call when not saving LR.
if (std::find(Regs.begin(), Regs.end(), AArch64::LR) == Regs.end())
if (!llvm::is_contained(Regs, AArch64::LR))
return false;
switch (Type) {

View File

@ -52940,13 +52940,13 @@ static bool matchAsm(StringRef S, ArrayRef<const char *> Pieces) {
static bool clobbersFlagRegisters(const SmallVector<StringRef, 4> &AsmPieces) {
if (AsmPieces.size() == 3 || AsmPieces.size() == 4) {
if (std::count(AsmPieces.begin(), AsmPieces.end(), "~{cc}") &&
std::count(AsmPieces.begin(), AsmPieces.end(), "~{flags}") &&
std::count(AsmPieces.begin(), AsmPieces.end(), "~{fpsr}")) {
if (llvm::is_contained(AsmPieces, "~{cc}") &&
llvm::is_contained(AsmPieces, "~{flags}") &&
llvm::is_contained(AsmPieces, "~{fpsr}")) {
if (AsmPieces.size() == 3)
return true;
else if (std::count(AsmPieces.begin(), AsmPieces.end(), "~{dirflag}"))
else if (llvm::is_contained(AsmPieces, "~{dirflag}"))
return true;
}
}

View File

@ -858,9 +858,7 @@ bool llvm::UnrollRuntimeLoopRemainder(
}
#if defined(EXPENSIVE_CHECKS) && !defined(NDEBUG)
for (BasicBlock *SuccBB : successors(BB)) {
assert(!(any_of(OtherExits,
[SuccBB](BasicBlock *EB) { return EB == SuccBB; }) ||
SuccBB == LatchExit) &&
assert(!(llvm::is_contained(OtherExits, SuccBB) || SuccBB == LatchExit) &&
"Breaks the definition of dedicated exits!");
}
#endif

View File

@ -4292,8 +4292,7 @@ void InnerLoopVectorizer::fixFirstOrderRecurrence(VPWidenPHIRecipe *PhiR,
// and thus no phis which needed updated.
if (!Cost->requiresScalarEpilogue(VF))
for (PHINode &LCSSAPhi : LoopExitBlock->phis())
if (any_of(LCSSAPhi.incoming_values(),
[Phi](Value *V) { return V == Phi; }))
if (llvm::is_contained(LCSSAPhi.incoming_values(), Phi))
LCSSAPhi.addIncoming(ExtractForPhiUsedOutsideLoop, LoopMiddleBlock);
}
@ -4451,8 +4450,7 @@ void InnerLoopVectorizer::fixReduction(VPReductionPHIRecipe *PhiR,
// fixFirstOrderRecurrence for a more complete explaination of the logic.
if (!Cost->requiresScalarEpilogue(VF))
for (PHINode &LCSSAPhi : LoopExitBlock->phis())
if (any_of(LCSSAPhi.incoming_values(),
[LoopExitInst](Value *V) { return V == LoopExitInst; }))
if (llvm::is_contained(LCSSAPhi.incoming_values(), LoopExitInst))
LCSSAPhi.addIncoming(ReducedPartRdx, LoopMiddleBlock);
// Fix the scalar loop reduction variable with the incoming reduction sum