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

Owen Anderson resistor at mac.com
Sun Apr 8 17:53:06 PDT 2007



Changes in directory llvm/lib/Transforms/Utils:

LoopSimplify.cpp updated: 1.84 -> 1.85
---
Log message:

Cleanup some from my DomSet-removal changes.  Add a new 
isReachableFromEntry
test to ETForest to factor a common test out of code.


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

 LoopSimplify.cpp |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)


Index: llvm/lib/Transforms/Utils/LoopSimplify.cpp
diff -u llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.84 llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.85
--- llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.84	Sat Apr  7 20:04:30 2007
+++ llvm/lib/Transforms/Utils/LoopSimplify.cpp	Sun Apr  8 19:52:49 2007
@@ -312,6 +312,8 @@
       // Can we eliminate this phi node now?
       if (Value *V = PN->hasConstantValue(true)) {
         Instruction *I = dyn_cast<Instruction>(V);
+        // If I is in NewBB, the ETForest call will fail, because NewBB isn't
+        // registered in ETForest yet.  Handle this case explicitly.
         if (!I || (I->getParent() != NewBB &&
                    getAnalysis<ETForest>().dominates(I, PN))) {
           PN->replaceAllUsesWith(V);
@@ -701,15 +703,13 @@
   {
     BasicBlock *OnePred = PredBlocks[0];
     unsigned i = 1, e = PredBlocks.size();
-    for (i = 1; !ETF.dominates(&OnePred->getParent()->getEntryBlock(), OnePred);
-         ++i) {
+    for (i = 1; !ETF.isReachableFromEntry(OnePred); ++i) {
       assert(i != e && "Didn't find reachable pred?");
       OnePred = PredBlocks[i];
     }
     
     for (; i != e; ++i)
-      if (PredBlocks[i] != OnePred &&
-          ETF.dominates(&PredBlocks[i]->getParent()->getEntryBlock(), OnePred)){
+      if (PredBlocks[i] != OnePred && ETF.isReachableFromEntry(OnePred)){
         NewBBDominatesNewBBSucc = false;
         break;
       }






More information about the llvm-commits mailing list