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

Chris Lattner lattner at cs.uiuc.edu
Wed Jun 28 09:39:07 PDT 2006



Changes in directory llvm/lib/Transforms/Scalar:

LoopUnswitch.cpp updated: 1.42 -> 1.43
---
Log message:

Don't unswitch really large loops even if they are mostly filled with empty
blocks.



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

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


Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.42 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.43
--- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.42	Tue Jun 27 17:26:09 2006
+++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp	Wed Jun 28 11:38:55 2006
@@ -333,6 +333,12 @@
   if (IsTrivialUnswitchCondition(L, LIC))
     return 0;
   
+  // If the loop is really large (over twice our threshold) don't even consider
+  // unswitching it.  This will produce a really large loop with lots of empty
+  // blocks.
+  if (L->getBlocks().size() > 2*Threshold)
+    return 2*Threshold;
+  
   unsigned Cost = 0;
   // FIXME: this is brain dead.  It should take into consideration code
   // shrinkage.






More information about the llvm-commits mailing list