1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[CodeGen, Transforms] Use llvm::any_of (NFC)

This commit is contained in:
Kazu Hirata 2020-12-24 09:08:36 -08:00
parent eb7b7b06a6
commit 682f8913a5
5 changed files with 33 additions and 37 deletions

View File

@ -57,11 +57,10 @@ LegalityPredicate LegalityPredicates::typePairAndMemDescInSet(
TypePairAndMemDesc Match = {Query.Types[TypeIdx0], Query.Types[TypeIdx1],
Query.MMODescrs[MMOIdx].SizeInBits,
Query.MMODescrs[MMOIdx].AlignInBits};
return std::find_if(
TypesAndMemDesc.begin(), TypesAndMemDesc.end(),
[=](const TypePairAndMemDesc &Entry) ->bool {
return llvm::any_of(TypesAndMemDesc,
[=](const TypePairAndMemDesc &Entry) -> bool {
return Match.isCompatible(Entry);
}) != TypesAndMemDesc.end();
});
};
}

View File

@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/CodeGen/MultiHazardRecognizer.h"
#include "llvm/ADT/STLExtras.h"
#include <algorithm>
#include <functional>
#include <numeric>
@ -25,7 +26,7 @@ void MultiHazardRecognizer::AddHazardRecognizer(
}
bool MultiHazardRecognizer::atIssueLimit() const {
return std::any_of(Recognizers.begin(), Recognizers.end(),
return llvm::any_of(Recognizers,
std::mem_fn(&ScheduleHazardRecognizer::atIssueLimit));
}
@ -72,7 +73,7 @@ bool MultiHazardRecognizer::ShouldPreferAnother(SUnit *SU) {
auto SPA = [=](std::unique_ptr<ScheduleHazardRecognizer> &R) {
return R->ShouldPreferAnother(SU);
};
return std::any_of(Recognizers.begin(), Recognizers.end(), SPA);
return llvm::any_of(Recognizers, SPA);
}
void MultiHazardRecognizer::AdvanceCycle() {

View File

@ -260,10 +260,9 @@ class CHRScope {
if (TailRegionSet.count(Parent))
return false;
assert(llvm::find_if(RegInfos,
[&Parent](const RegInfo &RI) {
return Parent == RI.R;
}) != RegInfos.end() &&
assert(llvm::any_of(
RegInfos,
[&Parent](const RegInfo &RI) { return Parent == RI.R; }) &&
"Must be in head");
return true;
});

View File

@ -355,8 +355,7 @@ bool llvm::isSafeToMoveBefore(Instruction &I, Instruction &InsertPoint,
// Check if there exists instructions which may throw, may synchonize, or may
// never return, from I to InsertPoint.
if (!isSafeToSpeculativelyExecute(&I))
if (std::any_of(InstsToCheck.begin(), InstsToCheck.end(),
[](Instruction *I) {
if (llvm::any_of(InstsToCheck, [](Instruction *I) {
if (I->mayThrow())
return true;
@ -375,11 +374,9 @@ bool llvm::isSafeToMoveBefore(Instruction &I, Instruction &InsertPoint,
// Check if I has any output/flow/anti dependences with instructions from \p
// StartInst to \p EndInst.
if (std::any_of(InstsToCheck.begin(), InstsToCheck.end(),
[&DI, &I](Instruction *CurInst) {
if (llvm::any_of(InstsToCheck, [&DI, &I](Instruction *CurInst) {
auto DepResult = DI->depends(&I, CurInst, true);
if (DepResult &&
(DepResult->isOutput() || DepResult->isFlow() ||
if (DepResult && (DepResult->isOutput() || DepResult->isFlow() ||
DepResult->isAnti()))
return true;
return false;

View File

@ -2472,9 +2472,9 @@ template <> struct DOTGraphTraits<BoUpSLP *> : public DefaultDOTGraphTraits {
}
for (auto V : Entry->Scalars) {
OS << *V;
if (std::any_of(
R->ExternalUses.begin(), R->ExternalUses.end(),
[&](const BoUpSLP::ExternalUser &EU) { return EU.Scalar == V; }))
if (llvm::any_of(R->ExternalUses, [&](const BoUpSLP::ExternalUser &EU) {
return EU.Scalar == V;
}))
OS << " <extract>";
OS << "\n";
}