diff options
author | Chris Lattner <sabre@nondot.org> | 2006-02-12 01:59:10 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-02-12 01:59:10 +0000 |
commit | 02f53ad3a21c3759d8a13b9d53e11cd0ecbba54a (patch) | |
tree | 78d83e35f05fbdfab25c9bee2b4db8c16f7bb5e8 /llvm/lib/Transforms/Utils/LoopSimplify.cpp | |
parent | 8e99b0baca2379c71f40000be1b4ed0fed5656b8 (diff) | |
download | bcm5719-llvm-02f53ad3a21c3759d8a13b9d53e11cd0ecbba54a.tar.gz bcm5719-llvm-02f53ad3a21c3759d8a13b9d53e11cd0ecbba54a.zip |
Revert my last patch. It too breaks stuff
llvm-svn: 26128
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopSimplify.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopSimplify.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp index 488915e96e2..a8aa0e0bbcc 100644 --- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp +++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp @@ -156,18 +156,12 @@ bool LoopSimplify::ProcessLoop(Loop *L) { // Next, check to make sure that all exit nodes of the loop only have // predecessors that are inside of the loop. This check guarantees that the // loop preheader/header will dominate the exit blocks. If the exit block has - // predecessors from outside of the loop, split the edge now. Note that we - // only want to consider the exit blocks of *this* loop, not of any subloops, - // so we can't use Loop::getExitBlocks(). + // predecessors from outside of the loop, split the edge now. + std::vector<BasicBlock*> ExitBlocks; + L->getExitBlocks(ExitBlocks); + + SetVector<BasicBlock*> ExitBlockSet(ExitBlocks.begin(), ExitBlocks.end()); LoopInfo &LI = getAnalysis<LoopInfo>(); - SetVector<BasicBlock*> ExitBlockSet; - for (Loop::block_iterator BI = L->block_begin(), - BE = L->block_end(); BI != BE; ++BI) - if (LI.getLoopFor(*BI) == L) // not a subloop. - for (succ_iterator I = succ_begin(*BI), E = succ_end(*BI); I != E; ++I) - if (!L->contains(*I)) // Not in current loop? - ExitBlockSet.insert(*I); // It must be an exit block. - for (SetVector<BasicBlock*>::iterator I = ExitBlockSet.begin(), E = ExitBlockSet.end(); I != E; ++I) { BasicBlock *ExitBlock = *I; @@ -175,7 +169,7 @@ bool LoopSimplify::ProcessLoop(Loop *L) { PI != PE; ++PI) // Must be exactly this loop: no subloops, parent loops, or non-loop preds // allowed. - if (LI.getLoopFor(*PI) != L) { + if (!L->contains(*PI)) { RewriteLoopExitBlock(L, ExitBlock); NumInserted++; Changed = true; |