diff options
author | Dan Gohman <gohman@apple.com> | 2009-02-12 18:08:24 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-02-12 18:08:24 +0000 |
commit | 6048c2c221a39e81d8e935dfa53e2c64c35a998e (patch) | |
tree | 0c31573c0c1c9425a476c7eedef8401d7fa2a15f /include/llvm/Analysis/LoopInfo.h | |
parent | a1bd6f0aed4c2491ad29b965dbb9c8b54bce4054 (diff) | |
download | external_llvm-6048c2c221a39e81d8e935dfa53e2c64c35a998e.tar.gz external_llvm-6048c2c221a39e81d8e935dfa53e2c64c35a998e.tar.bz2 external_llvm-6048c2c221a39e81d8e935dfa53e2c64c35a998e.zip |
Add a utility function to LoopInfo to return the exit block
when the loop has exactly one exit, and make use of it in
LoopIndexSplit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64388 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/LoopInfo.h')
-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 0fa4abe056..b2268a2d74 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -184,6 +184,16 @@ public: } } + /// getExitingBlock - If getExitingBlocks would return exactly one block, + /// return that block. Otherwise return null. + BlockT *getExitingBlock() const { + SmallVector<BlockT*, 8> ExitingBlocks; + getExitingBlocks(ExitingBlocks); + if (ExitingBlocks.size() == 1) + return ExitingBlocks[0]; + return 0; + } + /// getExitBlocks - Return all of the successor blocks of this loop. These /// are the blocks _outside of the current loop_ which are branched to. /// |