Skip to content

Commit

Permalink
[Analysis] Use llvm::is_contained (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata committed Nov 21, 2020
1 parent 6e965df commit 226beb4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions llvm/lib/Analysis/DomTreeUpdater.cpp
Expand Up @@ -32,8 +32,7 @@ bool DomTreeUpdater::isUpdateValid(
// Since isUpdateValid() must be called *after* the Terminator of From is
// altered we can determine if the update is unnecessary for batch updates
// or invalid for a single update.
const bool HasEdge = llvm::any_of(
successors(From), [To](const BasicBlock *B) { return B == To; });
const bool HasEdge = llvm::is_contained(successors(From), To);

// If the IR does not match the update,
// 1. In batch updates, this update is unnecessary.
Expand Down
5 changes: 2 additions & 3 deletions llvm/lib/Analysis/ValueTracking.cpp
Expand Up @@ -4723,7 +4723,7 @@ static bool canCreateUndefOrPoison(const Operator *Op, bool PoisonOnly) {
ArrayRef<int> Mask = isa<ConstantExpr>(Op)
? cast<ConstantExpr>(Op)->getShuffleMask()
: cast<ShuffleVectorInst>(Op)->getShuffleMask();
return any_of(Mask, [](int Elt) { return Elt == UndefMaskElem; });
return is_contained(Mask, UndefMaskElem);
}
case Instruction::FNeg:
case Instruction::PHI:
Expand Down Expand Up @@ -4877,8 +4877,7 @@ static bool isGuaranteedNotToBeUndefOrPoison(const Value *V,
else if (PoisonOnly && isa<Operator>(Cond)) {
// For poison, we can analyze further
auto *Opr = cast<Operator>(Cond);
if (propagatesPoison(Opr) &&
any_of(Opr->operand_values(), [&](Value *Op) { return Op == V; }))
if (propagatesPoison(Opr) && is_contained(Opr->operand_values(), V))
return true;
}
}
Expand Down

0 comments on commit 226beb4

Please sign in to comment.