diff options
| author | Dan Gohman <gohman@apple.com> | 2009-05-08 20:07:23 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-05-08 20:07:23 +0000 |
| commit | bd953333f8e2fd86462d91a2c9706ac36fe5b777 (patch) | |
| tree | 441868fd61c9b022da4b2ed605a0f620a1c2a4e9 /llvm/include | |
| parent | 3a0516b25abe6a7de47097f25d11707cd50332e7 (diff) | |
| download | bcm5719-llvm-bd953333f8e2fd86462d91a2c9706ac36fe5b777.tar.gz bcm5719-llvm-bd953333f8e2fd86462d91a2c9706ac36fe5b777.zip | |
Add a getExitBlock utility function to LoopInfo which returns the
exit block of a loop, if there is exactly one, similar to
getExitingBlock.
llvm-svn: 71245
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/Analysis/LoopInfo.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/include/llvm/Analysis/LoopInfo.h b/llvm/include/llvm/Analysis/LoopInfo.h index 01e5fa96fcc..69773a66ec1 100644 --- a/llvm/include/llvm/Analysis/LoopInfo.h +++ b/llvm/include/llvm/Analysis/LoopInfo.h @@ -213,6 +213,16 @@ public: ExitBlocks.push_back(*I); } + /// getExitBlock - If getExitBlocks would return exactly one block, + /// return that block. Otherwise return null. + BlockT *getExitBlock() const { + SmallVector<BlockT*, 8> ExitBlocks; + getExitBlocks(ExitBlocks); + if (ExitBlocks.size() == 1) + return ExitBlocks[0]; + return 0; + } + /// getUniqueExitBlocks - Return all unique successor blocks of this loop. /// These are the blocks _outside of the current loop_ which are branched to. /// This assumes that loop is in canonical form. |

