mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-27 14:24:40 +00:00
Teach LoopUnroll how to bail if LoopSimplify can't give it what it needs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86164 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -108,8 +108,19 @@ static BasicBlock *FoldBlockIntoPredecessor(BasicBlock *BB, LoopInfo* LI) {
|
|||||||
bool llvm::UnrollLoop(Loop *L, unsigned Count, LoopInfo* LI, LPPassManager* LPM) {
|
bool llvm::UnrollLoop(Loop *L, unsigned Count, LoopInfo* LI, LPPassManager* LPM) {
|
||||||
assert(L->isLCSSAForm());
|
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();
|
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());
|
BranchInst *BI = dyn_cast<BranchInst>(LatchBlock->getTerminator());
|
||||||
|
|
||||||
if (!BI || BI->isUnconditional()) {
|
if (!BI || BI->isUnconditional()) {
|
||||||
|
Reference in New Issue
Block a user