diff options
author | Dan Gohman <gohman@apple.com> | 2009-06-25 00:09:57 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-06-25 00:09:57 +0000 |
commit | 89893fb470e3939653058c6066a7efca50db8de4 (patch) | |
tree | 34b5b658dbeee579d47c8220d329bc3958eca8ba | |
parent | 512bedb6016f75bd764c823aaaf1e41b1ba0d593 (diff) | |
download | external_llvm-89893fb470e3939653058c6066a7efca50db8de4.zip external_llvm-89893fb470e3939653058c6066a7efca50db8de4.tar.gz external_llvm-89893fb470e3939653058c6066a7efca50db8de4.tar.bz2 |
Add a getUniqueExitBlock utility function, similar to getExitBlock,
but for getUniqueExitBlocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74145 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Analysis/LoopInfo.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index fb0b584..9e5f57e 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -281,6 +281,16 @@ public: } } + /// 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 |