[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopPreheaders.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Feb 27 21:09:01 PST 2003


Changes in directory llvm/lib/Transforms/Scalar:

LoopPreheaders.cpp updated: 1.8 -> 1.9

---
Log message:

Fix bug: LICM/2003-02-27-PreheaderExitNodeUpdate.ll



---
Diffs of the changes:

Index: llvm/lib/Transforms/Scalar/LoopPreheaders.cpp
diff -u llvm/lib/Transforms/Scalar/LoopPreheaders.cpp:1.8 llvm/lib/Transforms/Scalar/LoopPreheaders.cpp:1.9
--- llvm/lib/Transforms/Scalar/LoopPreheaders.cpp:1.8	Thu Feb 27 16:48:57 2003
+++ llvm/lib/Transforms/Scalar/LoopPreheaders.cpp	Thu Feb 27 21:07:54 2003
@@ -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 @@
   // 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.





More information about the llvm-commits mailing list