[llvm] Use llvm::any_of (NFC)

This commit is contained in:
Kazu Hirata 2021-01-04 11:42:47 -08:00
parent 0edbc90ec5
commit eb198f4c3c
10 changed files with 23 additions and 27 deletions

View File

@ -598,10 +598,9 @@ namespace llvm {
/// @p End.
bool isUndefIn(ArrayRef<SlotIndex> Undefs, SlotIndex Begin,
SlotIndex End) const {
return std::any_of(Undefs.begin(), Undefs.end(),
[Begin,End] (SlotIndex Idx) -> bool {
return Begin <= Idx && Idx < End;
});
return llvm::any_of(Undefs, [Begin, End](SlotIndex Idx) -> bool {
return Begin <= Idx && Idx < End;
});
}
/// Flush segment set into the regular segment vector.

View File

@ -1024,9 +1024,9 @@ bool MachineSinking::hasStoreBetween(MachineBasicBlock *From,
return HasStoreCache[BlockPair];
if (StoreInstrCache.find(BlockPair) != StoreInstrCache.end())
return std::any_of(
StoreInstrCache[BlockPair].begin(), StoreInstrCache[BlockPair].end(),
[&](MachineInstr *I) { return I->mayAlias(AA, MI, false); });
return llvm::any_of(StoreInstrCache[BlockPair], [&](MachineInstr *I) {
return I->mayAlias(AA, MI, false);
});
bool SawStore = false;
bool HasAliasedStore = false;

View File

@ -71,10 +71,10 @@ SelfTargetProcessControl::lookupSymbols(
for (auto &Elem : Request) {
auto *Dylib = jitTargetAddressToPointer<sys::DynamicLibrary *>(Elem.Handle);
assert(llvm::find_if(DynamicLibraries,
[=](const std::unique_ptr<sys::DynamicLibrary> &DL) {
return DL.get() == Dylib;
}) != DynamicLibraries.end() &&
assert(llvm::any_of(DynamicLibraries,
[=](const std::unique_ptr<sys::DynamicLibrary> &DL) {
return DL.get() == Dylib;
}) &&
"Invalid handle");
R.push_back(std::vector<JITTargetAddress>());

View File

@ -2657,9 +2657,8 @@ Error PassBuilder::parseFunctionPass(FunctionPassManager &FPM,
return Err;
// Add the nested pass manager with the appropriate adaptor.
bool UseMemorySSA = (Name == "loop-mssa");
bool UseBFI =
std::any_of(InnerPipeline.begin(), InnerPipeline.end(),
[](auto Pipeline) { return Pipeline.Name == "licm"; });
bool UseBFI = llvm::any_of(
InnerPipeline, [](auto Pipeline) { return Pipeline.Name == "licm"; });
FPM.addPass(createFunctionToLoopPassAdaptor(std::move(LPM), UseMemorySSA,
UseBFI, DebugLogging));
return Error::success();

View File

@ -522,7 +522,7 @@ void SMDiagnostic::print(const char *ProgName, raw_ostream &OS, bool ShowColors,
// map like Clang's TextDiagnostic. For now, we'll just handle tabs by
// expanding them later, and bail out rather than show incorrect ranges and
// misaligned fixits for any other odd characters.
if (find_if(LineContents, isNonASCII) != LineContents.end()) {
if (any_of(LineContents, isNonASCII)) {
printSourceLine(OS, LineContents);
return;
}

View File

@ -6739,7 +6739,7 @@ void AArch64InstrInfo::buildOutlinedFrame(
return MI.isCall() && !MI.isReturn();
};
if (std::any_of(MBB.instr_begin(), MBB.instr_end(), IsNonTailCall)) {
if (llvm::any_of(MBB.instrs(), IsNonTailCall)) {
// Fix up the instructions in the range, since we're going to modify the
// stack.

View File

@ -6256,7 +6256,7 @@ void ARMBaseInstrInfo::buildOutlinedFrame(
auto IsNonTailCall = [](MachineInstr &MI) {
return MI.isCall() && !MI.isReturn();
};
if (std::any_of(MBB.instr_begin(), MBB.instr_end(), IsNonTailCall)) {
if (llvm::any_of(MBB.instrs(), IsNonTailCall)) {
MachineBasicBlock::iterator It = MBB.begin();
MachineBasicBlock::iterator Et = MBB.end();

View File

@ -707,9 +707,8 @@ void ELFDumper<ELFT>::printSymbolsHelper(bool IsDynamic) const {
// The st_other field has 2 logical parts. The first two bits hold the symbol
// visibility (STV_*) and the remainder hold other platform-specific values.
bool NonVisibilityBitsUsed = llvm::find_if(Syms, [](const Elf_Sym &S) {
return S.st_other & ~0x3;
}) != Syms.end();
bool NonVisibilityBitsUsed =
llvm::any_of(Syms, [](const Elf_Sym &S) { return S.st_other & ~0x3; });
ELFDumperStyle->printSymtabMessage(SymtabSec, Entries, NonVisibilityBitsUsed);
for (const Elf_Sym &Sym : Syms)

View File

@ -789,9 +789,8 @@ public:
}
bool hasOptionalOperands() const {
return find_if(Classes, [](const ClassInfo &Class) {
return Class.IsOptional;
}) != Classes.end();
return any_of(Classes,
[](const ClassInfo &Class) { return Class.IsOptional; });
}
};

View File

@ -432,9 +432,9 @@ bool CombineRule::parseInstructionMatcher(
}
if (InstrOperand.isDef()) {
if (find_if(Roots, [&](const RootInfo &X) {
if (any_of(Roots, [&](const RootInfo &X) {
return X.getPatternSymbol() == Name;
}) != Roots.end()) {
})) {
N->setMatchRoot();
}
}
@ -460,9 +460,9 @@ bool CombineRule::parseWipMatchOpcodeMatcher(const CodeGenTarget &Target,
MatchDag.addInstrNode(makeDebugName(*this, Name), insertStrTab(Name),
MatchDag.getContext().makeEmptyOperandList());
if (find_if(Roots, [&](const RootInfo &X) {
if (any_of(Roots, [&](const RootInfo &X) {
return ArgName && X.getPatternSymbol() == ArgName->getValue();
}) != Roots.end()) {
})) {
N->setMatchRoot();
}