return;
for (auto &A : AVI->second)
- if (std::find(NAVV.begin(), NAVV.end(), A) == NAVV.end())
+ if (!llvm::is_contained(NAVV, A))
NAVV.push_back(A);
AffectedValues.erase(OV);
}
std::initializer_list<LLT> TypesInit) {
SmallVector<LLT, 4> Types = TypesInit;
return [=](const LegalityQuery &Query) {
- return std::find(Types.begin(), Types.end(), Query.Types[TypeIdx]) != Types.end();
+ return llvm::is_contained(Types, Query.Types[TypeIdx]);
};
}
SmallVector<std::pair<LLT, LLT>, 4> Types = TypesInit;
return [=](const LegalityQuery &Query) {
std::pair<LLT, LLT> Match = {Query.Types[TypeIdx0], Query.Types[TypeIdx1]};
- return std::find(Types.begin(), Types.end(), Match) != Types.end();
+ return llvm::is_contained(Types, Match);
};
}
}
bool AMDGPULibCalls::useNativeFunc(const StringRef F) const {
- return AllNative ||
- std::find(UseNative.begin(), UseNative.end(), F) != UseNative.end();
+ return AllNative || llvm::is_contained(UseNative, F);
}
void AMDGPULibCalls::initNativeFuncs() {
SmallVector<Metadata *, 4> All;
for (auto MD : NamedMD->operands())
for (const auto &Op : MD->operands())
- if (std::find(All.begin(), All.end(), Op.get()) == All.end())
+ if (!llvm::is_contained(All, Op.get()))
All.push_back(Op.get());
NamedMD->eraseFromParent();
return true;
// Otherwise, return true if any aliased SuperReg of GPR32 is not dead.
- std::vector<unsigned>::iterator search_begin = GPR64DeadDefs.begin();
- std::vector<unsigned>::iterator search_end = GPR64DeadDefs.end();
for (auto I : GPR32LiveDefs)
for (MCSuperRegIterator SR(I, TRI); SR.isValid(); ++SR)
- if (std::find(search_begin, search_end, *SR) == search_end)
- return true;
+ if (!llvm::is_contained(GPR64DeadDefs, *SR))
+ return true;
return false;
}
BlockFrequencyInfo &CallerBFI = GetBFI(*CallerFunc);
if (!isColdCallSite(CB, CallerBFI))
return false;
- auto It = std::find(AllCallsCold.begin(), AllCallsCold.end(), CallerFunc);
- if (It == AllCallsCold.end())
+ if (!llvm::is_contained(AllCallsCold, CallerFunc))
return false;
}
return true;
// (i.e. not to be extracted to the out of line function)
auto ToBeInlined = [&, this](BasicBlock *BB) {
return BB == ClonedOI->ReturnBlock ||
- (std::find(ClonedOI->Entries.begin(), ClonedOI->Entries.end(), BB) !=
- ClonedOI->Entries.end());
+ llvm::is_contained(ClonedOI->Entries, BB);
};
assert(ClonedOI && "Expecting OutlineInfo for single region outline");
void restrictToBlocks(SmallSetVector<BasicBlock *, 4> &Blocks) {
for (auto II = Insts.begin(); II != Insts.end();) {
- if (std::find(Blocks.begin(), Blocks.end(), (*II)->getParent()) ==
- Blocks.end()) {
+ if (!llvm::is_contained(Blocks, (*II)->getParent())) {
ActiveBlocks.remove((*II)->getParent());
II = Insts.erase(II);
} else {
auto VI = Values.begin();
while (BI != Blocks.end()) {
assert(VI != Values.end());
- if (std::find(NewBlocks.begin(), NewBlocks.end(), *BI) ==
- NewBlocks.end()) {
+ if (!llvm::is_contained(NewBlocks, *BI)) {
BI = Blocks.erase(BI);
VI = Values.erase(VI);
} else {
for (auto &I : *Parent) {
auto *VPI = cast<VPInstruction>(&I);
if (VPI->getOpcode() == Instruction::Load &&
- std::find(Operands.begin(), Operands.end(), VPI) != Operands.end())
+ llvm::is_contained(Operands, VPI))
LoadsSeen++;
if (LoadsSeen == Operands.size())
for (const VPBlockBase *Succ : Successors) {
// There must be a bi-directional link between block and successor.
const auto &SuccPreds = Succ->getPredecessors();
- assert(std::find(SuccPreds.begin(), SuccPreds.end(), VPB) !=
- SuccPreds.end() &&
- "Missing predecessor link.");
+ assert(llvm::is_contained(SuccPreds, VPB) && "Missing predecessor link.");
(void)SuccPreds;
}
// There must be a bi-directional link between block and predecessor.
const auto &PredSuccs = Pred->getSuccessors();
- assert(std::find(PredSuccs.begin(), PredSuccs.end(), VPB) !=
- PredSuccs.end() &&
- "Missing successor link.");
+ assert(llvm::is_contained(PredSuccs, VPB) && "Missing successor link.");
(void)PredSuccs;
}
}
for (Function &F : *M)
for (BasicBlock &BB : F)
// Check if this block is going to be extracted.
- if (std::find(BBs.begin(), BBs.end(), &BB) == BBs.end())
+ if (!llvm::is_contained(BBs, &BB))
BlocksToExtract.push_back(&BB);
raw_fd_ostream OS(Temp->FD, /*shouldClose*/ false);
template <EscapeTag Tag> void writeEscaped(raw_ostream &OS, const StringRef S);
template <> void writeEscaped<kEscapeCsv>(raw_ostream &OS, const StringRef S) {
- if (std::find(S.begin(), S.end(), kCsvSep) == S.end()) {
+ if (!llvm::is_contained(S, kCsvSep)) {
OS << S;
} else {
// Needs escaping.