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

Chris Lattner lattner at cs.uiuc.edu
Thu Feb 9 17:36:47 PST 2006



Changes in directory llvm/lib/Transforms/Scalar:

LoopUnswitch.cpp updated: 1.10 -> 1.11
---
Log message:

When unswitching a trivial loop, do admit we are doing it! :)


---
Diffs of the changes:  (+7 -0)

 LoopUnswitch.cpp |    7 +++++++
 1 files changed, 7 insertions(+)


Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.10 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.11
--- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.10	Thu Feb  9 19:24:09 2006
+++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp	Thu Feb  9 19:36:35 2006
@@ -346,6 +346,11 @@
 /// moving the conditional branch outside of the loop and updating loop info.
 void LoopUnswitch::UnswitchTrivialCondition(Loop *L, Value *Cond, 
                                             ConstantBool *LoopCond) {
+  DEBUG(std::cerr << "loop-unswitch: Trivial-Unswitch loop %"
+        << L->getHeader()->getName() << " [" << L->getBlocks().size()
+        << " blocks] in Function " << L->getHeader()->getParent()->getName()
+        << " on cond:" << *Cond << "\n");
+  
   // First step, split the preahder, so that we know that there is a safe place
   // to insert the conditional branch.  We will change 'OrigPH' to have a
   // conditional branch on Cond.
@@ -373,6 +378,8 @@
   // particular value, rewrite the loop with this info.  We know that this will
   // at least eliminate the old branch.
   RewriteLoopBodyWithConditionConstant(L, Cond, EnterOnTrue);
+  
+  ++NumUnswitched;
 }
 
 






More information about the llvm-commits mailing list