[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) if (DarwinRefKind != MCSymbolRefExpr::VK_None)
return false; return false;
for (unsigned i = 0; i != AllowedModifiers.size(); ++i) { return llvm::is_contained(AllowedModifiers, ELFRefKind);
if (ELFRefKind == AllowedModifiers[i])
return true;
}
return false;
} }
bool isMovWSymbolG3() const { bool isMovWSymbolG3() const {

View File

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

View File

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

View File

@ -294,7 +294,7 @@ static int getOutliningPenalty(ArrayRef<BasicBlock *> Region,
// Find all incoming values from the outlining region. // Find all incoming values from the outlining region.
int NumIncomingVals = 0; int NumIncomingVals = 0;
for (unsigned i = 0; i < PN.getNumIncomingValues(); ++i) 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; ++NumIncomingVals;
if (NumIncomingVals > 1) { if (NumIncomingVals > 1) {
++NumSplitExitPhis; ++NumSplitExitPhis;

View File

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