[llvm-commits] [llvm] r113526 - /llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp

Owen Anderson resistor at mac.com
Thu Sep 9 12:08:59 PDT 2010


Author: resistor
Date: Thu Sep  9 14:08:59 2010
New Revision: 113526

URL: http://llvm.org/viewvc/llvm-project?rev=113526&view=rev
Log:
Fix typo in code to cap the loop code size reduction calculation.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp?rev=113526&r1=113525&r2=113526&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp Thu Sep  9 14:08:59 2010
@@ -27,7 +27,7 @@
 using namespace llvm;
 
 static cl::opt<unsigned>
-UnrollThreshold("unroll-threshold", cl::init(200), cl::Hidden,
+UnrollThreshold("unroll-threshold", cl::init(0), cl::Hidden,
   cl::desc("The cut-off point for automatic loop unrolling"));
 
 static cl::opt<unsigned>
@@ -105,7 +105,7 @@
     unsigned SizeDecrease = Metrics.CountCodeReductionForConstant(IndVar);
     // NOTE: Because SizeDecrease is a fuzzy estimate, we don't want to allow
     // it to totally negate the cost of unrolling a loop.
-    SizeDecrease = SizeDecrease > LoopSize / 2 ? LoopSize : SizeDecrease;
+    SizeDecrease = SizeDecrease > LoopSize / 2 ? LoopSize / 2 : SizeDecrease;
   }
   
   // Don't allow an estimate of size zero.  This would allows unrolling of loops





More information about the llvm-commits mailing list