diff options
author | Chris Lattner <sabre@nondot.org> | 2003-02-28 03:07:54 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-02-28 03:07:54 +0000 |
commit | 32a39c26e0117d895621f0727643812379054961 (patch) | |
tree | b12bb1e320e27a6619d742028aa59c9c9a4054a7 /llvm/lib/Transforms/Scalar/LoopSimplify.cpp | |
parent | 915e1a48547baecd510169a0a7ea4375516b1138 (diff) | |
download | bcm5719-llvm-32a39c26e0117d895621f0727643812379054961.tar.gz bcm5719-llvm-32a39c26e0117d895621f0727643812379054961.zip |
Fix bug: LICM/2003-02-27-PreheaderExitNodeUpdate.ll
llvm-svn: 5667
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopSimplify.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopSimplify.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopSimplify.cpp b/llvm/lib/Transforms/Scalar/LoopSimplify.cpp index c5adfd25534..3759f44f64c 100644 --- a/llvm/lib/Transforms/Scalar/LoopSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/LoopSimplify.cpp @@ -28,6 +28,7 @@ #include "llvm/Support/CFG.h" #include "Support/SetOperations.h" #include "Support/Statistic.h" +#include "Support/DepthFirstIterator.h" namespace { Statistic<> NumInserted("preheaders", "Number of pre-header nodes inserted"); @@ -303,7 +304,10 @@ void Preheaders::RewriteLoopExitBlock(Loop *L, BasicBlock *Exit) { // loop of L. if (Loop *Parent = L->getParentLoop()) Parent->addBasicBlockToLoop(NewBB, getAnalysis<LoopInfo>()); - L->changeExitBlock(Exit, NewBB); // Update exit block information + + // Replace any instances of Exit with NewBB in this and any nested loops... + for (df_iterator<Loop*> I = df_begin(L), E = df_end(L); I != E; ++I) + I->changeExitBlock(Exit, NewBB); // Update exit block information // Update dominator information... The blocks that dominate NewBB are the // intersection of the dominators of predecessors, plus the block itself. |