From a264dc09336ea163aabbdcb59694f76750f2d46c Mon Sep 17 00:00:00 2001 From: Pete Cooper Date: Wed, 13 May 2015 22:19:13 +0000 Subject: 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 --- llvm/lib/Analysis/LoopInfo.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'llvm/lib/Analysis/LoopInfo.cpp') 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 -- cgit v1.2.3