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

Chris Lattner lattner at cs.uiuc.edu
Wed Jul 14 22:36:41 PDT 2004



Changes in directory llvm/lib/Transforms/Scalar:

LoopSimplify.cpp updated: 1.45 -> 1.46

---
Log message:

Revert previous patch until I get a bug fixed


---
Diffs of the changes:  (+12 -12)

Index: llvm/lib/Transforms/Scalar/LoopSimplify.cpp
diff -u llvm/lib/Transforms/Scalar/LoopSimplify.cpp:1.45 llvm/lib/Transforms/Scalar/LoopSimplify.cpp:1.46
--- llvm/lib/Transforms/Scalar/LoopSimplify.cpp:1.45	Wed Jul 14 23:27:04 2004
+++ llvm/lib/Transforms/Scalar/LoopSimplify.cpp	Thu Jul 15 00:36:31 2004
@@ -147,9 +147,6 @@
     Changed = true;
   }
 
-
-  DominatorSet &DS = getAnalysis<DominatorSet>();  // Update dominator info
-
   // 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
@@ -158,16 +155,19 @@
   L->getExitBlocks(ExitBlocks);
   for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) {
     BasicBlock *ExitBlock = ExitBlocks[i];
-    if (!DS.dominates(L->getHeader(), ExitBlock)) {
-      BasicBlock *NewBB = RewriteLoopExitBlock(L, ExitBlock);
-      for (unsigned j = i; j != ExitBlocks.size(); ++j)
-        if (ExitBlocks[j] == ExitBlock)
-          ExitBlocks[j] = NewBB;
-      
-      NumInserted++;
-      Changed = true;
+    for (pred_iterator PI = pred_begin(ExitBlock), PE = pred_end(ExitBlock);
+         PI != PE; ++PI)
+      if (!L->contains(*PI)) {
+        BasicBlock *NewBB = RewriteLoopExitBlock(L, ExitBlock);
+        for (unsigned j = i; j != ExitBlocks.size(); ++j)
+          if (ExitBlocks[j] == ExitBlock)
+            ExitBlocks[j] = NewBB;
+
+        NumInserted++;
+        Changed = true;
+        break;
+      }
     }
-  }
 
   // If the header has more than two predecessors at this point (from the
   // preheader and from multiple backedges), we must adjust the loop.





More information about the llvm-commits mailing list