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 | 4d43d3c72cd43c1e37e0ab4eae9235044012bb81 (patch) | |
tree | 321c410d5cad5206d58e113899d0a9cc049dcdb0 /llvm/lib/Transforms/Utils/LoopSimplify.cpp | |
parent | 73669defedc32af0144e740932c0467d6aeb2055 (diff) | |
download | bcm5719-llvm-4d43d3c72cd43c1e37e0ab4eae9235044012bb81.tar.gz bcm5719-llvm-4d43d3c72cd43c1e37e0ab4eae9235044012bb81.zip |
Remove 'unwinds to' support from mainline. This patch undoes r47802 r47989
r48047 r48084 r48085 r48086 r48088 r48096 r48099 r48109 and r48123.
llvm-svn: 50265
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopSimplify.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopSimplify.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp index fc97287f191..8e30e042862 100644 --- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp +++ b/llvm/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 -----------------===// |