[llvm] 81e9c90 - [llvm] Use llvm::is_contained (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 14 22:44:28 PDT 2021
Author: Kazu Hirata
Date: 2021-10-14T22:44:09-07:00
New Revision: 81e9c90686f7bfbdd721b8e1a780152c95c258b0
URL: https://github.com/llvm/llvm-project/commit/81e9c90686f7bfbdd721b8e1a780152c95c258b0
DIFF: https://github.com/llvm/llvm-project/commit/81e9c90686f7bfbdd721b8e1a780152c95c258b0.diff
LOG: [llvm] Use llvm::is_contained (NFC)
Added:
Modified:
llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
llvm/include/llvm/Support/CommandLine.h
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/IR/Assumptions.cpp
llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
index e0a511686c323..991605a664e72 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
@@ -373,8 +373,7 @@ class DWARFContext : public DIContext {
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);
diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h
index ef95f9cca749c..2ee02010ff1d9 100644
--- a/llvm/include/llvm/Support/CommandLine.h
+++ b/llvm/include/llvm/Support/CommandLine.h
@@ -316,9 +316,7 @@ class Option {
}
bool isInAllSubCommands() const {
- return any_of(Subs, [](const SubCommand *SC) {
- return SC == &*AllSubCommands;
- });
+ return llvm::is_contained(Subs, &*AllSubCommands);
}
//-------------------------------------------------------------------------===
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 0354e1d30b7a4..6408bff539ca8 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -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();
diff --git a/llvm/lib/IR/Assumptions.cpp b/llvm/lib/IR/Assumptions.cpp
index 918a77484df5f..693757ee8b57e 100644
--- a/llvm/lib/IR/Assumptions.cpp
+++ b/llvm/lib/IR/Assumptions.cpp
@@ -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
diff --git a/llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp b/llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp
index be19d4953857a..487e1f6162b9e 100644
--- a/llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp
+++ b/llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp
@@ -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) {
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 6f2055ef79fd3..fc6bde29b50fc 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -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;
}
}
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
index 1b994015322ed..22d6d5c948a00 100644
--- a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
@@ -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
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 5416bdf590168..77b3f4d4dfdb4 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -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
More information about the llvm-commits
mailing list