diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2008-04-25 16:53:59 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2008-04-25 16:53:59 +0000 |
commit | 280a6e607d8eb7401749a92db624a82de47da777 (patch) | |
tree | 040d0b406293ebcc56801552313daa6136ee5e6c /lib/Transforms/Utils/LoopSimplify.cpp | |
parent | 419ace9bda6abaaa65560708064b210b4e48880f (diff) |
Remove 'unwinds to' support from mainline. This patch undoes r47802 r47989
r48047 r48084 r48085 r48086 r48088 r48096 r48099 r48109 and r48123.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50265 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/LoopSimplify.cpp')
-rw-r--r-- | lib/Transforms/Utils/LoopSimplify.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/Transforms/Utils/LoopSimplify.cpp b/lib/Transforms/Utils/LoopSimplify.cpp index fc97287f19..8e30e04286 100644 --- a/lib/Transforms/Utils/LoopSimplify.cpp +++ b/lib/Transforms/Utils/LoopSimplify.cpp @@ -125,17 +125,18 @@ bool LoopSimplify::runOnFunction(Function &F) { if (LI->getLoopFor(BB)) continue; bool BlockUnreachable = false; + TerminatorInst *TI = BB->getTerminator(); // Check to see if any successors of this block are non-loop-header loops // that are not the header. - for (succ_iterator I = succ_begin(BB), E = succ_end(BB); I != E; ++I) { + for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i) { // If this successor is not in a loop, BB is clearly ok. - Loop *L = LI->getLoopFor(*I); + Loop *L = LI->getLoopFor(TI->getSuccessor(i)); if (!L) continue; // If the succ is the loop header, and if L is a top-level loop, then this // is an entrance into a loop through the header, which is also ok. - if (L->getHeader() == *I && L->getParentLoop() == 0) + if (L->getHeader() == TI->getSuccessor(i) && L->getParentLoop() == 0) continue; // Otherwise, this is an entrance into a loop from some place invalid. @@ -153,11 +154,10 @@ bool LoopSimplify::runOnFunction(Function &F) { // loop by replacing the terminator. // Remove PHI entries from the successors. - for (succ_iterator I = succ_begin(BB), E = succ_end(BB); I != E; ++I) - (*I)->removePredecessor(BB); + for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i) + TI->getSuccessor(i)->removePredecessor(BB); // Add a new unreachable instruction before the old terminator. - TerminatorInst *TI = BB->getTerminator(); new UnreachableInst(TI); // Delete the dead terminator. @@ -576,15 +576,12 @@ void LoopSimplify::InsertUniqueBackedgeBlock(Loop *L) { } // Now that all of the PHI nodes have been inserted and adjusted, modify the - // backedge blocks to branch to the BEBlock instead of the header. + // backedge blocks to just to the BEBlock instead of the header. for (unsigned i = 0, e = BackedgeBlocks.size(); i != e; ++i) { TerminatorInst *TI = BackedgeBlocks[i]->getTerminator(); for (unsigned Op = 0, e = TI->getNumSuccessors(); Op != e; ++Op) if (TI->getSuccessor(Op) == Header) TI->setSuccessor(Op, BEBlock); - - if (BackedgeBlocks[i]->getUnwindDest() == Header) - BackedgeBlocks[i]->setUnwindDest(BEBlock); } //===--- Update all analyses which we must preserve now -----------------===// |