[llvm] 226beb4 - [Analysis] Use llvm::is_contained (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 20 18:09:00 PST 2020
Author: Kazu Hirata
Date: 2020-11-20T18:08:05-08:00
New Revision: 226beb494c863babb9d726634942eaebf7c60521
URL: https://github.com/llvm/llvm-project/commit/226beb494c863babb9d726634942eaebf7c60521
DIFF: https://github.com/llvm/llvm-project/commit/226beb494c863babb9d726634942eaebf7c60521.diff
LOG: [Analysis] Use llvm::is_contained (NFC)
Added:
Modified:
llvm/lib/Analysis/DomTreeUpdater.cpp
llvm/lib/Analysis/ValueTracking.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/DomTreeUpdater.cpp b/llvm/lib/Analysis/DomTreeUpdater.cpp
index 9594da0a4f91..e690d6491356 100644
--- a/llvm/lib/Analysis/DomTreeUpdater.cpp
+++ b/llvm/lib/Analysis/DomTreeUpdater.cpp
@@ -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.
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 9d5761649bb3..bcf35111502e 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -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;
}
}
More information about the llvm-commits
mailing list