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

[Analysis] Use llvm::is_contained (NFC)

This commit is contained in:
Kazu Hirata 2020-11-20 18:08:05 -08:00
parent ec50a05ed6
commit e1edf84b2d
2 changed files with 3 additions and 5 deletions

View File

@ -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.

View File

@ -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:
@ -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;
}
}