aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis/LoopInfo.h
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2011-08-10 00:28:10 +0000
committerAndrew Trick <atrick@apple.com>2011-08-10 00:28:10 +0000
commitb1eede12818d91a32adac928c6fffcf6d2800dc0 (patch)
tree4070b1152a0888c9b929e2e6779b19063e6e371f /include/llvm/Analysis/LoopInfo.h
parent33e57515b173baf572398fafeffcf4644c2a7381 (diff)
downloadexternal_llvm-b1eede12818d91a32adac928c6fffcf6d2800dc0.zip
external_llvm-b1eede12818d91a32adac928c6fffcf6d2800dc0.tar.gz
external_llvm-b1eede12818d91a32adac928c6fffcf6d2800dc0.tar.bz2
Fix the LoopUnroller to handle nontrivial loops and partial unrolling.
These are not individual bug fixes. I had to rewrite a good chunk of the unroller to make it sane. I think it was getting lucky on trivial completely unrolled loops with no early exits. I included some fairly simple unit tests for partial unrolling. I didn't do much stress testing, so it may not be perfect, but should be usable now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137190 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/LoopInfo.h')
-rw-r--r--include/llvm/Analysis/LoopInfo.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h
index 28a15ed..48c59ac 100644
--- a/include/llvm/Analysis/LoopInfo.h
+++ b/include/llvm/Analysis/LoopInfo.h
@@ -134,6 +134,11 @@ public:
block_iterator block_begin() const { return Blocks.begin(); }
block_iterator block_end() const { return Blocks.end(); }
+ /// getNumBlocks - Get the number of blocks in this loop.
+ unsigned getNumBlocks() const {
+ return std::distance(block_begin(), block_end());
+ }
+
/// isLoopExiting - True if terminator in the block can branch to another
/// block that is outside of the current loop.
///