summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-06-25 00:09:57 +0000
committerDan Gohman <gohman@apple.com>2009-06-25 00:09:57 +0000
commit72777de7d1c2c5ffb27f75de04818cb212406e31 (patch)
tree893db9beb3a54e04626da3256eb8c425cd9c1fb6 /llvm
parentb5042f20e72ad73fefec6688904f3ec474a6433e (diff)
downloadbcm5719-llvm-72777de7d1c2c5ffb27f75de04818cb212406e31.tar.gz
bcm5719-llvm-72777de7d1c2c5ffb27f75de04818cb212406e31.zip
Add a getUniqueExitBlock utility function, similar to getExitBlock,
but for getUniqueExitBlocks. llvm-svn: 74145
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Analysis/LoopInfo.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/include/llvm/Analysis/LoopInfo.h b/llvm/include/llvm/Analysis/LoopInfo.h
index fb0b584d41c..9e5f57e9a19 100644
--- a/llvm/include/llvm/Analysis/LoopInfo.h
+++ b/llvm/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
OpenPOWER on IntegriCloud