Teach LoopUnroll how to bail if LoopSimplify can't give it what it needs.

llvm-svn: 86164
This commit is contained in:
Dan Gohman 2009-11-05 19:44:06 +00:00
parent d9fa1c9c1e
commit 415c64ea3f
1 changed files with 12 additions and 1 deletions

View File

@ -108,8 +108,19 @@ static BasicBlock *FoldBlockIntoPredecessor(BasicBlock *BB, LoopInfo* LI) {
bool llvm::UnrollLoop(Loop *L, unsigned Count, LoopInfo* LI, LPPassManager* LPM) {
assert(L->isLCSSAForm());
BasicBlock *Header = L->getHeader();
BasicBlock *Preheader = L->getLoopPreheader();
if (!Preheader) {
DEBUG(errs() << " Can't unroll; loop preheader-insertion failed.\n");
return false;
}
BasicBlock *LatchBlock = L->getLoopLatch();
if (!LatchBlock) {
DEBUG(errs() << " Can't unroll; loop exit-block-insertion failed.\n");
return false;
}
BasicBlock *Header = L->getHeader();
BranchInst *BI = dyn_cast<BranchInst>(LatchBlock->getTerminator());
if (!BI || BI->isUnconditional()) {