[llvm-commits] [llvm] r121758 - /llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp

Chris Lattner sabre at nondot.org
Mon Dec 13 23:23:10 PST 2010


Author: lattner
Date: Tue Dec 14 01:23:10 2010
New Revision: 121758

URL: http://llvm.org/viewvc/llvm-project?rev=121758&view=rev
Log:
tidy up a bit, move DEBUG down to when we commit to doing the transform so we 
don't print it unless the xform happens.

Modified:
    llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp

Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=121758&r1=121757&r2=121758&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Tue Dec 14 01:23:10 2010
@@ -1161,9 +1161,6 @@
     if (NumPhis > 2)
       return false;
   
-  DEBUG(dbgs() << "FOUND IF CONDITION!  " << *IfCond << "  T: "
-        << IfTrue->getName() << "  F: " << IfFalse->getName() << "\n");
-  
   // Loop over the PHI's seeing if we can promote them all to select
   // instructions.  While we are at it, keep track of the instructions
   // that need to be moved to the dominating block.
@@ -1192,8 +1189,7 @@
   if (cast<BranchInst>(Pred->getTerminator())->isUnconditional()) {
     IfBlock1 = Pred;
     DomBlock = *pred_begin(Pred);
-    for (BasicBlock::iterator I = Pred->begin();
-         !isa<TerminatorInst>(I); ++I)
+    for (BasicBlock::iterator I = Pred->begin(); !isa<TerminatorInst>(I); ++I)
       if (!AggressiveInsts.count(I) && !isa<DbgInfoIntrinsic>(I)) {
         // This is not an aggressive instruction that we can promote.
         // Because of this, we won't be able to get rid of the control
@@ -1206,8 +1202,7 @@
   if (cast<BranchInst>(Pred->getTerminator())->isUnconditional()) {
     IfBlock2 = Pred;
     DomBlock = *pred_begin(Pred);
-    for (BasicBlock::iterator I = Pred->begin();
-         !isa<TerminatorInst>(I); ++I)
+    for (BasicBlock::iterator I = Pred->begin(); !isa<TerminatorInst>(I); ++I)
       if (!AggressiveInsts.count(I) && !isa<DbgInfoIntrinsic>(I)) {
         // This is not an aggressive instruction that we can promote.
         // Because of this, we won't be able to get rid of the control
@@ -1215,6 +1210,9 @@
         return false;
       }
   }
+  
+  DEBUG(dbgs() << "FOUND IF CONDITION!  " << *IfCond << "  T: "
+        << IfTrue->getName() << "  F: " << IfFalse->getName() << "\n");
       
   // If we can still promote the PHI nodes after this gauntlet of tests,
   // do all of the PHI's now.





More information about the llvm-commits mailing list