[Transforms] Use llvm::find_if (NFC)

This commit is contained in:
Kazu Hirata 2021-01-09 09:24:58 -08:00
parent 9a7c03b800
commit 4d92ab1669
3 changed files with 5 additions and 8 deletions

View File

@ -888,8 +888,7 @@ void GVNHoist::findHoistableCandidates(OutValuesType &CHIBBs,
auto TI = BB->getTerminator();
auto B = CHIs.begin();
// [PreIt, PHIIt) form a range of CHIs which have identical VNs.
auto PHIIt = std::find_if(CHIs.begin(), CHIs.end(),
[B](CHIArg &A) { return A != *B; });
auto PHIIt = llvm::find_if(CHIs, [B](CHIArg &A) { return A != *B; });
auto PrevIt = CHIs.begin();
while (PrevIt != PHIIt) {
// Collect values which satisfy safety checks.

View File

@ -624,7 +624,7 @@ public:
else if (!TrueDestSucc.empty()) {
Function *F = TrueDest->getParent();
auto IsSucc = [&](BasicBlock &BB) { return TrueDestSucc.count(&BB); };
auto It = std::find_if(F->begin(), F->end(), IsSucc);
auto It = llvm::find_if(*F, IsSucc);
assert(It != F->end() && "Could not find successor in function");
CommonSucc = &*It;
}
@ -692,8 +692,7 @@ public:
return BB != Pair.second && (Pair.first->getSuccessor(0) == BB ||
Pair.first->getSuccessor(1) == BB);
};
auto It = std::find_if(HoistableBranches.begin(), HoistableBranches.end(),
HasBBAsSuccessor);
auto It = llvm::find_if(HoistableBranches, HasBBAsSuccessor);
// If not involved in a pending branch, hoist to preheader
BasicBlock *InitialPreheader = CurLoop->getLoopPreheader();

View File

@ -628,9 +628,8 @@ static BasicBlock *mergeComparisons(ArrayRef<BCECmpBlock> Comparisons,
// If there is one block that requires splitting, we do it now, i.e.
// just before we know we will collapse the chain. The instructions
// can be executed before any of the instructions in the chain.
const auto ToSplit =
std::find_if(Comparisons.begin(), Comparisons.end(),
[](const BCECmpBlock &B) { return B.RequireSplit; });
const auto ToSplit = llvm::find_if(
Comparisons, [](const BCECmpBlock &B) { return B.RequireSplit; });
if (ToSplit != Comparisons.end()) {
LLVM_DEBUG(dbgs() << "Splitting non_BCE work to header\n");
ToSplit->split(BB, AA);