diff options
Diffstat (limited to 'contrib/llvm-project/llvm/include/llvm/Analysis/LoopInfoImpl.h')
-rw-r--r-- | contrib/llvm-project/llvm/include/llvm/Analysis/LoopInfoImpl.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/LoopInfoImpl.h b/contrib/llvm-project/llvm/include/llvm/Analysis/LoopInfoImpl.h index 58a4abafcc85..426b349c6b8a 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/LoopInfoImpl.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/LoopInfoImpl.h @@ -68,6 +68,13 @@ void LoopBase<BlockT, LoopT>::getExitBlocks( ExitBlocks.push_back(Succ); } +template <class BlockT, class LoopT> +bool LoopBase<BlockT, LoopT>::hasNoExitBlocks() const { + SmallVector<BlockT *, 8> ExitBlocks; + getExitBlocks(ExitBlocks); + return ExitBlocks.empty(); +} + /// getExitBlock - If getExitBlocks would return exactly one block, /// return that block. Otherwise return null. template <class BlockT, class LoopT> @@ -502,7 +509,7 @@ void PopulateLoopsDFS<BlockT, LoopT>::insertIntoLoop(BlockT *Block) { if (Subloop && Block == Subloop->getHeader()) { // We reach this point once per subloop after processing all the blocks in // the subloop. - if (Subloop->getParentLoop()) + if (!Subloop->isOutermost()) Subloop->getParentLoop()->getSubLoopsVector().push_back(Subloop); else LI->addTopLevelLoop(Subloop); @@ -666,12 +673,13 @@ static void compareLoops(const LoopT *L, const LoopT *OtherL, "Mismatched basic blocks in the loops!"); const SmallPtrSetImpl<const BlockT *> &BlocksSet = L->getBlocksSet(); - const SmallPtrSetImpl<const BlockT *> &OtherBlocksSet = L->getBlocksSet(); + const SmallPtrSetImpl<const BlockT *> &OtherBlocksSet = + OtherL->getBlocksSet(); assert(BlocksSet.size() == OtherBlocksSet.size() && - std::all_of(BlocksSet.begin(), BlocksSet.end(), - [&OtherBlocksSet](const BlockT *BB) { - return OtherBlocksSet.count(BB); - }) && + llvm::all_of(BlocksSet, + [&OtherBlocksSet](const BlockT *BB) { + return OtherBlocksSet.count(BB); + }) && "Mismatched basic blocks in BlocksSets!"); } #endif @@ -681,7 +689,7 @@ void LoopInfoBase<BlockT, LoopT>::verify( const DomTreeBase<BlockT> &DomTree) const { DenseSet<const LoopT *> Loops; for (iterator I = begin(), E = end(); I != E; ++I) { - assert(!(*I)->getParentLoop() && "Top-level loop has a parent!"); + assert((*I)->isOutermost() && "Top-level loop has a parent!"); (*I)->verifyLoopNest(&Loops); } |