1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +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 // Since isUpdateValid() must be called *after* the Terminator of From is
// altered we can determine if the update is unnecessary for batch updates // altered we can determine if the update is unnecessary for batch updates
// or invalid for a single update. // or invalid for a single update.
const bool HasEdge = llvm::any_of( const bool HasEdge = llvm::is_contained(successors(From), To);
successors(From), [To](const BasicBlock *B) { return B == To; });
// If the IR does not match the update, // If the IR does not match the update,
// 1. In batch updates, this update is unnecessary. // 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) ArrayRef<int> Mask = isa<ConstantExpr>(Op)
? cast<ConstantExpr>(Op)->getShuffleMask() ? cast<ConstantExpr>(Op)->getShuffleMask()
: cast<ShuffleVectorInst>(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::FNeg:
case Instruction::PHI: case Instruction::PHI:
@ -4877,8 +4877,7 @@ static bool isGuaranteedNotToBeUndefOrPoison(const Value *V,
else if (PoisonOnly && isa<Operator>(Cond)) { else if (PoisonOnly && isa<Operator>(Cond)) {
// For poison, we can analyze further // For poison, we can analyze further
auto *Opr = cast<Operator>(Cond); auto *Opr = cast<Operator>(Cond);
if (propagatesPoison(Opr) && if (propagatesPoison(Opr) && is_contained(Opr->operand_values(), V))
any_of(Opr->operand_values(), [&](Value *Op) { return Op == V; }))
return true; return true;
} }
} }