Index: include/llvm/Analysis/LoopInfoImpl.h =================================================================== --- include/llvm/Analysis/LoopInfoImpl.h +++ include/llvm/Analysis/LoopInfoImpl.h @@ -87,7 +87,9 @@ // within the loop. SmallVector ExitBlocks; getExitBlocks(ExitBlocks); - for (BlockT *EB : ExitBlocks) + SmallPtrSet UniqExitBlocks; + UniqExitBlocks.insert(ExitBlocks.begin(), ExitBlocks.end()); + for (BlockT *EB : UniqExitBlocks) for (BlockT *Predecessor : children>(EB)) if (!contains(Predecessor)) return false;