[llvm] Use llvm::is_contained (NFC) (#135566)

This commit is contained in:
Kazu Hirata 2025-04-13 16:35:29 -07:00 committed by GitHub
parent 5d87ebf3ad
commit 20d35fe5a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 7 additions and 16 deletions

View File

@ -467,10 +467,7 @@ public:
/// Returns true if Reg contains RegUnit.
bool hasRegUnit(MCRegister Reg, MCRegUnit RegUnit) const {
for (MCRegUnit Unit : regunits(Reg))
if (Unit == RegUnit)
return true;
return false;
return llvm::is_contained(regunits(Reg), RegUnit);
}
/// Returns the original SrcReg unless it is the target of a copy-like

View File

@ -679,8 +679,7 @@ MachineInstr *WindowScheduler::getOriMI(MachineInstr *NewMI) {
}
unsigned WindowScheduler::getOriStage(MachineInstr *OriMI, unsigned Offset) {
assert(llvm::find(OriMIs, OriMI) != OriMIs.end() &&
"Cannot find OriMI in OriMIs!");
assert(llvm::is_contained(OriMIs, OriMI) && "Cannot find OriMI in OriMIs!");
// If there is no instruction fold, all MI stages are 0.
if (Offset == SchedPhiNum)
return 0;

View File

@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/ExecutionEngine/Orc/Shared/ObjectFormats.h"
#include "llvm/ADT/STLExtras.h"
namespace llvm {
namespace orc {
@ -34,10 +35,7 @@ StringRef ELFThreadBSSSectionName = ".tbss";
StringRef ELFThreadDataSectionName = ".tdata";
bool isMachOInitializerSection(StringRef QualifiedName) {
for (auto &InitSection : MachOInitSectionNames)
if (InitSection == QualifiedName)
return true;
return false;
return llvm::is_contained(MachOInitSectionNames, QualifiedName);
}
bool isELFInitializerSection(StringRef SecName) {

View File

@ -50,8 +50,7 @@ public:
/// Check if the symbol has a mapping. Having a mapping means the handle is
/// replaced with a reference
bool checkImageHandleSymbol(StringRef Symbol) const {
return ImageHandleList.end() !=
std::find(ImageHandleList.begin(), ImageHandleList.end(), Symbol);
return llvm::is_contained(ImageHandleList, Symbol);
}
};
}

View File

@ -125,8 +125,7 @@ bool SPIRVExtensionsParser::parse(cl::Option &O, StringRef ArgName,
if (Token.starts_with("+")) {
EnabledExtensions.insert(NameValuePair->second);
} else if (EnabledExtensions.count(NameValuePair->second)) {
if (std::find(Tokens.begin(), Tokens.end(), "+" + ExtensionName.str()) !=
Tokens.end())
if (llvm::is_contained(Tokens, "+" + ExtensionName.str()))
return O.error(
"Extension cannot be allowed and disallowed at the same time: " +
ExtensionName.str());

View File

@ -3807,8 +3807,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::identifyClones(
// Make sure we don't pick a previously existing caller edge of this
// Node, which would be processed on a different iteration of the
// outer loop over the saved CallerEdges.
if (std::find(CallerEdges.begin(), CallerEdges.end(), E) !=
CallerEdges.end())
if (llvm::is_contained(CallerEdges, E))
continue;
// The CallerAllocTypeForAlloc and CalleeEdgeAllocTypesForCallerEdge
// are updated further below for all cases where we just invoked