summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-02-28 03:07:54 +0000
committerChris Lattner <sabre@nondot.org>2003-02-28 03:07:54 +0000
commit74cd04ea0154defa837a6d4c12bad29aae44e5b6 (patch)
tree1b27a31a38852e99035148539a115017d826b470 /lib
parent1db0a400370466e187ae06c96a1586c2c21409dd (diff)
downloadexternal_llvm-74cd04ea0154defa837a6d4c12bad29aae44e5b6.zip
external_llvm-74cd04ea0154defa837a6d4c12bad29aae44e5b6.tar.gz
external_llvm-74cd04ea0154defa837a6d4c12bad29aae44e5b6.tar.bz2
Fix bug: LICM/2003-02-27-PreheaderExitNodeUpdate.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5667 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Utils/LoopSimplify.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/LoopSimplify.cpp b/lib/Transforms/Utils/LoopSimplify.cpp
index c5adfd2..3759f44 100644
--- a/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/lib/Transforms/Utils/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.