diff options
author | Davide Italiano <davide@freebsd.org> | 2016-05-17 14:24:41 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2016-05-17 14:24:41 +0000 |
commit | b75b16e2ffe71f35d75c0229fd60e11171c4b7c3 (patch) | |
tree | e3d7a2b041c09168950099ba227f0280afbe3097 /llvm/lib/Transforms/Utils/LCSSA.cpp | |
parent | 9210be54317208cf64370e8b1956db47f5d5ecff (diff) | |
download | bcm5719-llvm-b75b16e2ffe71f35d75c0229fd60e11171c4b7c3.tar.gz bcm5719-llvm-b75b16e2ffe71f35d75c0229fd60e11171c4b7c3.zip |
[LCSSA] Use any_of() to simplify the code. NFCI.
llvm-svn: 269767
Diffstat (limited to 'llvm/lib/Transforms/Utils/LCSSA.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LCSSA.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Utils/LCSSA.cpp b/llvm/lib/Transforms/Utils/LCSSA.cpp index 0abb1f440d3..5db36136509 100644 --- a/llvm/lib/Transforms/Utils/LCSSA.cpp +++ b/llvm/lib/Transforms/Utils/LCSSA.cpp @@ -53,10 +53,8 @@ STATISTIC(NumLCSSA, "Number of live out of a loop variables"); /// Return true if the specified block is in the list. static bool isExitBlock(BasicBlock *BB, const SmallVectorImpl<BasicBlock *> &ExitBlocks) { - for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) - if (ExitBlocks[i] == BB) - return true; - return false; + return std::any_of(ExitBlocks.begin(), ExitBlocks.end(), + [&](BasicBlock *EB) { return EB == BB; }); } /// Given an instruction in the loop, check to see if it has any uses that are @@ -210,11 +208,9 @@ blockDominatesAnExit(BasicBlock *BB, DominatorTree &DT, const SmallVectorImpl<BasicBlock *> &ExitBlocks) { DomTreeNode *DomNode = DT.getNode(BB); - for (BasicBlock *ExitBB : ExitBlocks) - if (DT.dominates(DomNode, DT.getNode(ExitBB))) - return true; - - return false; + return std::any_of(ExitBlocks.begin(), ExitBlocks.end(), [&](BasicBlock *EB) { + return DT.dominates(DomNode, DT.getNode(EB)); + }); } bool llvm::formLCSSA(Loop &L, DominatorTree &DT, LoopInfo *LI, |