[llvm-commits] [llvm] r74145 - /llvm/trunk/include/llvm/Analysis/LoopInfo.h

Dan Gohman gohman at apple.com
Wed Jun 24 17:09:57 PDT 2009


Author: djg
Date: Wed Jun 24 19:09:57 2009
New Revision: 74145

URL: http://llvm.org/viewvc/llvm-project?rev=74145&view=rev
Log:
Add a getUniqueExitBlock utility function, similar to getExitBlock,
but for getUniqueExitBlocks.

Modified:
    llvm/trunk/include/llvm/Analysis/LoopInfo.h

Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=74145&r1=74144&r2=74145&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Wed Jun 24 19:09:57 2009
@@ -281,6 +281,16 @@
     }
   }
 
+  /// getUniqueExitBlock - If getUniqueExitBlocks would return exactly one
+  /// block, return that block. Otherwise return null.
+  BlockT *getUniqueExitBlock() const {
+    SmallVector<BlockT*, 8> UniqueExitBlocks;
+    getUniqueExitBlocks(UniqueExitBlocks);
+    if (UniqueExitBlocks.size() == 1)
+      return UniqueExitBlocks[0];
+    return 0;
+  }
+
   /// getLoopPreheader - If there is a preheader for this loop, return it.  A
   /// loop has a preheader if there is only one edge to the header of the loop
   /// from outside of the loop.  If this is the case, the block branching to the





More information about the llvm-commits mailing list