diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp index b789c8b26cc5..29c4aced75e7 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp @@ -1487,7 +1487,7 @@ static bool canEvaluateShuffled(Value *V, ArrayRef Mask, // Propagating an undefined shuffle mask element to integer div/rem is not // allowed because those opcodes can create immediate undefined behavior // from an undefined element in an operand. - if (llvm::any_of(Mask, [](int M){ return M == -1; })) + if (llvm::is_contained(Mask, -1)) return false; LLVM_FALLTHROUGH; case Instruction::Add: diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp index d1cab0899db0..443ff5b817f7 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp @@ -675,7 +675,7 @@ bool ObjCARCOpt::OptimizeInlinedAutoreleaseRVCall( SmallVector ArgUsers; getEquivalentPHIs(*PN, ArgUsers); - if (llvm::find(ArgUsers, AutoreleaseRVArg) == ArgUsers.end()) + if (!llvm::is_contained(ArgUsers, AutoreleaseRVArg)) return false; } diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index ba2a6fc1ef49..32b38fd97f31 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -2804,8 +2804,7 @@ void GVN::addDeadBlock(BasicBlock *BB) { if (!DeadBlocks.count(P)) continue; - if (llvm::any_of(successors(P), - [B](BasicBlock *Succ) { return Succ == B; }) && + if (llvm::is_contained(successors(P), B) && isCriticalEdge(P->getTerminator(), B)) { if (BasicBlock *S = splitCriticalEdges(P, B)) DeadBlocks.insert(P = S); diff --git a/llvm/lib/Transforms/Scalar/GVNHoist.cpp b/llvm/lib/Transforms/Scalar/GVNHoist.cpp index 44b3417d9d45..ea47f2a17969 100644 --- a/llvm/lib/Transforms/Scalar/GVNHoist.cpp +++ b/llvm/lib/Transforms/Scalar/GVNHoist.cpp @@ -806,11 +806,8 @@ bool GVNHoist::valueAnticipable(CHIArgs C, Instruction *TI) const { return false; // Not enough args in this CHI. for (auto CHI : C) { - BasicBlock *Dest = CHI.Dest; // Find if all the edges have values flowing out of BB. - bool Found = llvm::any_of( - successors(TI), [Dest](const BasicBlock *BB) { return BB == Dest; }); - if (!Found) + if (!llvm::is_contained(successors(TI), CHI.Dest)) return false; } return true; diff --git a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp index afa4c4dfaa66..81b7c3a8338a 100644 --- a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp +++ b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp @@ -701,8 +701,7 @@ bool LoopInterchangeLegality::findInductionAndReductions( Value *V = followLCSSA(PHI.getIncomingValueForBlock(L->getLoopLatch())); PHINode *InnerRedPhi = findInnerReductionPhi(InnerLoop, V); if (!InnerRedPhi || - !llvm::any_of(InnerRedPhi->incoming_values(), - [&PHI](Value *V) { return V == &PHI; })) { + !llvm::is_contained(InnerRedPhi->incoming_values(), &PHI)) { LLVM_DEBUG( dbgs() << "Failed to recognize PHI as an induction or reduction.\n"); diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index 0abedb5f34c5..85d1be1ebd29 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -237,7 +237,7 @@ bool llvm::MergeBlockIntoPredecessor(BasicBlock *BB, DomTreeUpdater *DTU, // times. We add inserts before deletes here to reduce compile time. for (auto I = succ_begin(BB), E = succ_end(BB); I != E; ++I) // This successor of BB may already have PredBB as a predecessor. - if (llvm::find(successors(PredBB), *I) == succ_end(PredBB)) + if (!llvm::is_contained(successors(PredBB), *I)) Updates.push_back({DominatorTree::Insert, PredBB, *I}); for (auto I = succ_begin(BB), E = succ_end(BB); I != E; ++I) Updates.push_back({DominatorTree::Delete, BB, *I}); diff --git a/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp b/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp index 39fb504cf7b7..e42f469ad32c 100644 --- a/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp +++ b/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp @@ -270,7 +270,7 @@ llvm::SplitCriticalEdge(Instruction *TI, unsigned SuccNum, SmallVector Updates; Updates.push_back({DominatorTree::Insert, TIBB, NewBB}); Updates.push_back({DominatorTree::Insert, NewBB, DestBB}); - if (llvm::find(successors(TIBB), DestBB) == succ_end(TIBB)) + if (!llvm::is_contained(successors(TIBB), DestBB)) Updates.push_back({DominatorTree::Delete, TIBB, DestBB}); if (DT) diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index afbba4c83964..8e1683e2d85a 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -760,7 +760,7 @@ void llvm::MergeBasicBlockIntoOnlyPred(BasicBlock *DestBB, for (auto I = pred_begin(PredBB), E = pred_end(PredBB); I != E; ++I) { Updates.push_back({DominatorTree::Delete, *I, PredBB}); // This predecessor of PredBB may already have DestBB as a successor. - if (llvm::find(successors(*I), DestBB) == succ_end(*I)) + if (!llvm::is_contained(successors(*I), DestBB)) Updates.push_back({DominatorTree::Insert, *I, DestBB}); } } @@ -1072,7 +1072,7 @@ bool llvm::TryToSimplifyUncondBranchFromEmptyBlock(BasicBlock *BB, for (auto I = pred_begin(BB), E = pred_end(BB); I != E; ++I) { Updates.push_back({DominatorTree::Delete, *I, BB}); // This predecessor of BB may already have Succ as a successor. - if (llvm::find(successors(*I), Succ) == succ_end(*I)) + if (!llvm::is_contained(successors(*I), Succ)) Updates.push_back({DominatorTree::Insert, *I, Succ}); } }