[llvm] Use llvm::is_contained (NFC)

This commit is contained in:
Kazu Hirata 2021-12-11 11:42:09 -08:00
parent d395befa65
commit 36b8a4f9f3
5 changed files with 6 additions and 13 deletions

View File

@ -1031,12 +1031,7 @@ public:
if (DarwinRefKind != MCSymbolRefExpr::VK_None)
return false;
for (unsigned i = 0; i != AllowedModifiers.size(); ++i) {
if (ELFRefKind == AllowedModifiers[i])
return true;
}
return false;
return llvm::is_contained(AllowedModifiers, ELFRefKind);
}
bool isMovWSymbolG3() const {

View File

@ -366,7 +366,7 @@ bool MVETPAndVPTOptimisations::MergeLoopEnd(MachineLoop *ML) {
while (!Worklist.empty()) {
Register Reg = Worklist.pop_back_val();
for (MachineInstr &MI : MRI->use_nodbg_instructions(Reg)) {
if (count(ExpectedUsers, &MI))
if (llvm::is_contained(ExpectedUsers, &MI))
continue;
if (MI.getOpcode() != TargetOpcode::COPY ||
!MI.getOperand(0).getReg().isVirtual()) {

View File

@ -2139,12 +2139,10 @@ bool Attributor::shouldSeedAttribute(AbstractAttribute &AA) {
bool Result = true;
#ifndef NDEBUG
if (SeedAllowList.size() != 0)
Result =
std::count(SeedAllowList.begin(), SeedAllowList.end(), AA.getName());
Result = llvm::is_contained(SeedAllowList, AA.getName());
Function *Fn = AA.getAnchorScope();
if (FunctionSeedAllowList.size() != 0 && Fn)
Result &= std::count(FunctionSeedAllowList.begin(),
FunctionSeedAllowList.end(), Fn->getName());
Result &= llvm::is_contained(FunctionSeedAllowList, Fn->getName());
#endif
return Result;
}

View File

@ -294,7 +294,7 @@ static int getOutliningPenalty(ArrayRef<BasicBlock *> Region,
// Find all incoming values from the outlining region.
int NumIncomingVals = 0;
for (unsigned i = 0; i < PN.getNumIncomingValues(); ++i)
if (find(Region, PN.getIncomingBlock(i)) != Region.end()) {
if (llvm::is_contained(Region, PN.getIncomingBlock(i))) {
++NumIncomingVals;
if (NumIncomingVals > 1) {
++NumSplitExitPhis;

View File

@ -1398,7 +1398,7 @@ bool PredTransitions::mutuallyExclusive(Record *PredDef,
//
// if (A) return ...;
// if (B) return ...;
if (!count(Preds, PC.Predicate))
if (!llvm::is_contained(Preds, PC.Predicate))
continue;
return true;
}