Fix PR1101 and Analysis/ScalarEvolution/trip-count.ll

llvm-svn: 33193
This commit is contained in:
Chris Lattner 2007-01-14 01:24:47 +00:00
parent 0a57468829
commit 5a55476211
1 changed files with 5 additions and 3 deletions

View File

@ -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());