aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-01-14 01:24:47 +0000
committerChris Lattner <sabre@nondot.org>2007-01-14 01:24:47 +0000
commit192e4037445f4141cd44c0080e3eeb2718d41466 (patch)
tree9a5fc5830e0840cef4099f5de703da86ac1d110e /lib/Analysis
parentd8523aa5de3df25d03e1c90d5a489a322f366c29 (diff)
downloadexternal_llvm-192e4037445f4141cd44c0080e3eeb2718d41466.zip
external_llvm-192e4037445f4141cd44c0080e3eeb2718d41466.tar.gz
external_llvm-192e4037445f4141cd44c0080e3eeb2718d41466.tar.bz2
Fix PR1101 and Analysis/ScalarEvolution/trip-count.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33193 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 20a979a..be661d9 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -1506,10 +1506,12 @@ SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) {
//
// Currently we check for this by checking to see if the Exit branch goes to
// the loop header. If so, we know it will always execute the same number of
- // times as the loop. More extensive analysis could be done to handle more
- // cases here.
+ // times as the loop. We also handle the case where the exit block *is* the
+ // loop header. This is common for un-rotated loops. More extensive analysis
+ // could be done to handle more cases here.
if (ExitBr->getSuccessor(0) != L->getHeader() &&
- ExitBr->getSuccessor(1) != L->getHeader())
+ ExitBr->getSuccessor(1) != L->getHeader() &&
+ ExitBr->getParent() != L->getHeader())
return UnknownValue;
ICmpInst *ExitCond = dyn_cast<ICmpInst>(ExitBr->getCondition());