diff options
| author | Devang Patel <dpatel@apple.com> | 2008-02-13 22:06:36 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2008-02-13 22:06:36 +0000 |
| commit | 22c3caab6ee56e418b75e2321ad06e54f92a5221 (patch) | |
| tree | c9971e474da6fc26d45022a6ba39fc06a3f5787b /llvm/lib | |
| parent | 654c78fd2df13a6a870bde0217f9c16a31f8a127 (diff) | |
| download | bcm5719-llvm-22c3caab6ee56e418b75e2321ad06e54f92a5221.tar.gz bcm5719-llvm-22c3caab6ee56e418b75e2321ad06e54f92a5221.zip | |
While moving exit condition, do not drop loop latch on the floor.
llvm-svn: 47089
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp b/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp index 2d30eb6ff56..383415b228b 100644 --- a/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp @@ -1579,17 +1579,22 @@ void LoopIndexSplit::moveExitCondition(BasicBlock *CondBB, BasicBlock *ActiveBB, // destination. BranchInst *ExitingBR = cast<BranchInst>(ExitingBB->getTerminator()); ExitingBR->moveBefore(CurrentBR); - if (ExitingBR->getSuccessor(0) == ExitBB) + BasicBlock *OrigDestBB = NULL; + if (ExitingBR->getSuccessor(0) == ExitBB) { + OrigDestBB = ExitingBR->getSuccessor(1); ExitingBR->setSuccessor(1, ActiveBB); - else + } + else { + OrigDestBB = ExitingBR->getSuccessor(0); ExitingBR->setSuccessor(0, ActiveBB); + } // Remove split condition and current split condition branch. SC->eraseFromParent(); CurrentBR->eraseFromParent(); - // Connect exiting block to split condition block. - new BranchInst(CondBB, ExitingBB); + // Connect exiting block to original destination. + new BranchInst(OrigDestBB, ExitingBB); // Update PHINodes updatePHINodes(ExitBB, ExitingBB, CondBB, IV, IVAdd); |

