LoopUnrollPass: Use variable "Threshold" instead of "CurrentThreshold" when
authorHongbin Zheng <etherzhhb@gmail.com>
Wed, 4 Apr 2012 11:44:08 +0000 (11:44 +0000)
committerHongbin Zheng <etherzhhb@gmail.com>
Wed, 4 Apr 2012 11:44:08 +0000 (11:44 +0000)
  reducing unroll count, otherwise the reduced unroll count is not taking
  the "OptimizeForSize" attribute into account.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154007 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopUnrollPass.cpp

index 22dbfe326c65300674da1c8debecfb8b6de514d9..09a186f7f9403b218b6f8528ce306700d7499ff2 100644 (file)
@@ -197,13 +197,13 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
       }
       if (TripCount) {
         // Reduce unroll count to be modulo of TripCount for partial unrolling
-        Count = CurrentThreshold / LoopSize;
+        Count = Threshold / LoopSize;
         while (Count != 0 && TripCount%Count != 0)
           Count--;
       }
       else if (UnrollRuntime) {
         // Reduce unroll count to be a lower power-of-two value
-        while (Count != 0 && Size > CurrentThreshold) {
+        while (Count != 0 && Size > Threshold) {
           Count >>= 1;
           Size = LoopSize*Count;
         }