From 36b8a4f9f39c9d1b9cd6cae9aebc82cbdb37815b Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 11 Dec 2021 11:42:09 -0800 Subject: [PATCH] [llvm] Use llvm::is_contained (NFC) --- llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp | 7 +------ llvm/lib/Target/ARM/MVETPAndVPTOptimisationsPass.cpp | 2 +- llvm/lib/Transforms/IPO/Attributor.cpp | 6 ++---- llvm/lib/Transforms/IPO/HotColdSplitting.cpp | 2 +- llvm/utils/TableGen/CodeGenSchedule.cpp | 2 +- 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp index 6d3aea2..62038b1 100644 --- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -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 { diff --git a/llvm/lib/Target/ARM/MVETPAndVPTOptimisationsPass.cpp b/llvm/lib/Target/ARM/MVETPAndVPTOptimisationsPass.cpp index dc58b54..7e31ea7 100644 --- a/llvm/lib/Target/ARM/MVETPAndVPTOptimisationsPass.cpp +++ b/llvm/lib/Target/ARM/MVETPAndVPTOptimisationsPass.cpp @@ -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()) { diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp index edadc79..7e729e5 100644 --- a/llvm/lib/Transforms/IPO/Attributor.cpp +++ b/llvm/lib/Transforms/IPO/Attributor.cpp @@ -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; } diff --git a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp index 833049d..a964fcd 100644 --- a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp +++ b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp @@ -294,7 +294,7 @@ static int getOutliningPenalty(ArrayRef 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; diff --git a/llvm/utils/TableGen/CodeGenSchedule.cpp b/llvm/utils/TableGen/CodeGenSchedule.cpp index ee52b2e..7c1c37f 100644 --- a/llvm/utils/TableGen/CodeGenSchedule.cpp +++ b/llvm/utils/TableGen/CodeGenSchedule.cpp @@ -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; } -- 2.7.4