Skip to content

Commit 20d35fe

Browse files
[llvm] Use llvm::is_contained (NFC) (llvm#135566)
1 parent 5d87ebf commit 20d35fe

File tree

6 files changed

+7
-16
lines changed

6 files changed

+7
-16
lines changed

llvm/include/llvm/CodeGen/TargetRegisterInfo.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,10 +467,7 @@ class TargetRegisterInfo : public MCRegisterInfo {
467467

468468
/// Returns true if Reg contains RegUnit.
469469
bool hasRegUnit(MCRegister Reg, MCRegUnit RegUnit) const {
470-
for (MCRegUnit Unit : regunits(Reg))
471-
if (Unit == RegUnit)
472-
return true;
473-
return false;
470+
return llvm::is_contained(regunits(Reg), RegUnit);
474471
}
475472

476473
/// Returns the original SrcReg unless it is the target of a copy-like

llvm/lib/CodeGen/WindowScheduler.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,8 +679,7 @@ MachineInstr *WindowScheduler::getOriMI(MachineInstr *NewMI) {
679679
}
680680

681681
unsigned WindowScheduler::getOriStage(MachineInstr *OriMI, unsigned Offset) {
682-
assert(llvm::find(OriMIs, OriMI) != OriMIs.end() &&
683-
"Cannot find OriMI in OriMIs!");
682+
assert(llvm::is_contained(OriMIs, OriMI) && "Cannot find OriMI in OriMIs!");
684683
// If there is no instruction fold, all MI stages are 0.
685684
if (Offset == SchedPhiNum)
686685
return 0;

llvm/lib/ExecutionEngine/Orc/Shared/ObjectFormats.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "llvm/ExecutionEngine/Orc/Shared/ObjectFormats.h"
14+
#include "llvm/ADT/STLExtras.h"
1415

1516
namespace llvm {
1617
namespace orc {
@@ -34,10 +35,7 @@ StringRef ELFThreadBSSSectionName = ".tbss";
3435
StringRef ELFThreadDataSectionName = ".tdata";
3536

3637
bool isMachOInitializerSection(StringRef QualifiedName) {
37-
for (auto &InitSection : MachOInitSectionNames)
38-
if (InitSection == QualifiedName)
39-
return true;
40-
return false;
38+
return llvm::is_contained(MachOInitSectionNames, QualifiedName);
4139
}
4240

4341
bool isELFInitializerSection(StringRef SecName) {

llvm/lib/Target/NVPTX/NVPTXMachineFunctionInfo.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ class NVPTXMachineFunctionInfo : public MachineFunctionInfo {
5050
/// Check if the symbol has a mapping. Having a mapping means the handle is
5151
/// replaced with a reference
5252
bool checkImageHandleSymbol(StringRef Symbol) const {
53-
return ImageHandleList.end() !=
54-
std::find(ImageHandleList.begin(), ImageHandleList.end(), Symbol);
53+
return llvm::is_contained(ImageHandleList, Symbol);
5554
}
5655
};
5756
}

llvm/lib/Target/SPIRV/SPIRVCommandLine.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ bool SPIRVExtensionsParser::parse(cl::Option &O, StringRef ArgName,
125125
if (Token.starts_with("+")) {
126126
EnabledExtensions.insert(NameValuePair->second);
127127
} else if (EnabledExtensions.count(NameValuePair->second)) {
128-
if (std::find(Tokens.begin(), Tokens.end(), "+" + ExtensionName.str()) !=
129-
Tokens.end())
128+
if (llvm::is_contained(Tokens, "+" + ExtensionName.str()))
130129
return O.error(
131130
"Extension cannot be allowed and disallowed at the same time: " +
132131
ExtensionName.str());

llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3807,8 +3807,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::identifyClones(
38073807
// Make sure we don't pick a previously existing caller edge of this
38083808
// Node, which would be processed on a different iteration of the
38093809
// outer loop over the saved CallerEdges.
3810-
if (std::find(CallerEdges.begin(), CallerEdges.end(), E) !=
3811-
CallerEdges.end())
3810+
if (llvm::is_contained(CallerEdges, E))
38123811
continue;
38133812
// The CallerAllocTypeForAlloc and CalleeEdgeAllocTypesForCallerEdge
38143813
// are updated further below for all cases where we just invoked

0 commit comments

Comments
 (0)