diff options
author | Chris Lattner <sabre@nondot.org> | 2007-01-14 01:24:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-01-14 01:24:47 +0000 |
commit | 5a554762110eaf391b9bdde38f6b23a357560a0a (patch) | |
tree | 6344884331a01ab75208f1cad627678d34335f42 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | 0a57468829e24fa0060e8d1aca7fc525340414aa (diff) | |
download | bcm5719-llvm-5a554762110eaf391b9bdde38f6b23a357560a0a.tar.gz bcm5719-llvm-5a554762110eaf391b9bdde38f6b23a357560a0a.zip |
Fix PR1101 and Analysis/ScalarEvolution/trip-count.ll
llvm-svn: 33193
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 20a979a2e57..be661d9768d 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/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()); |