Fix typo in code to cap the loop code size reduction calculation.
authorOwen Anderson <resistor@mac.com>
Thu, 9 Sep 2010 19:08:59 +0000 (19:08 +0000)
committerOwen Anderson <resistor@mac.com>
Thu, 9 Sep 2010 19:08:59 +0000 (19:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113526 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopUnrollPass.cpp

index 967ce93a2428addee1dc7129ba8585a3e6513eb0..9c5c5912239c5218bdeae0de0b312101ca5e351d 100644 (file)
@@ -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 @@ static unsigned ApproximateLoopSize(const Loop *L, unsigned &NumCalls) {
     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