Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions llvm/include/llvm/CodeGen/TargetRegisterInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,7 @@ class TargetRegisterInfo : public MCRegisterInfo {

/// 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
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/WindowScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/ExecutionEngine/Orc/Shared/ObjectFormats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//

#include "llvm/ExecutionEngine/Orc/Shared/ObjectFormats.h"
#include "llvm/ADT/STLExtras.h"

namespace llvm {
namespace orc {
Expand All @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/NVPTX/NVPTXMachineFunctionInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ class NVPTXMachineFunctionInfo : public MachineFunctionInfo {
/// 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);
}
};
}
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/SPIRV/SPIRVCommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading