summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2015-05-13 22:19:13 +0000
committerPete Cooper <peter_cooper@apple.com>2015-05-13 22:19:13 +0000
commita264dc09336ea163aabbdcb59694f76750f2d46c (patch)
treebe91ee2b6c6c6b149a2fac9cbb76bee146702ffc /llvm/lib/Analysis
parentab9fd035fdc4a3babfd70f3642758aad2695ad26 (diff)
downloadbcm5719-llvm-a264dc09336ea163aabbdcb59694f76750f2d46c.tar.gz
bcm5719-llvm-a264dc09336ea163aabbdcb59694f76750f2d46c.zip
Add llvm::all_of which wraps std::all_of.
This version doesn't need begin/end but can instead just take a type which has begin/end methods. Use this to replace an eligible foreach loop in LoopInfo found by David Blaikie in r237224. Reviewed by David Blaikie. llvm-svn: 237301
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/LoopInfo.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp
index 932b080eb3e..6b6faf8a66c 100644
--- a/llvm/lib/Analysis/LoopInfo.cpp
+++ b/llvm/lib/Analysis/LoopInfo.cpp
@@ -65,11 +65,7 @@ bool Loop::isLoopInvariant(const Value *V) const {
/// hasLoopInvariantOperands - Return true if all the operands of the
/// specified instruction are loop invariant.
bool Loop::hasLoopInvariantOperands(const Instruction *I) const {
- for (auto &Op : I->operands())
- if (!isLoopInvariant(Op))
- return false;
-
- return true;
+ return all_of(I->operands(), [this](Value *V) { return isLoopInvariant(V); });
}
/// makeLoopInvariant - If the given value is an instruciton inside of the
OpenPOWER on IntegriCloud