forked from OSchip/llvm-project
[Transforms] Use llvm::is_contained (NFC)
This commit is contained in:
parent
b51e844f7a
commit
43c0e4f665
|
@ -1487,7 +1487,7 @@ static bool canEvaluateShuffled(Value *V, ArrayRef<int> 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:
|
||||
|
|
|
@ -675,7 +675,7 @@ bool ObjCARCOpt::OptimizeInlinedAutoreleaseRVCall(
|
|||
|
||||
SmallVector<const Value *, 4> ArgUsers;
|
||||
getEquivalentPHIs(*PN, ArgUsers);
|
||||
if (llvm::find(ArgUsers, AutoreleaseRVArg) == ArgUsers.end())
|
||||
if (!llvm::is_contained(ArgUsers, AutoreleaseRVArg))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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});
|
||||
|
|
|
@ -270,7 +270,7 @@ llvm::SplitCriticalEdge(Instruction *TI, unsigned SuccNum,
|
|||
SmallVector<DominatorTree::UpdateType, 3> 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)
|
||||
|
|
|
@ -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});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue