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

Hongbin Zheng etherzhhb at gmail.com
Wed Apr 4 04:44:08 PDT 2012


Author: ether
Date: Wed Apr  4 06:44:08 2012
New Revision: 154007

URL: http://llvm.org/viewvc/llvm-project?rev=154007&view=rev
Log:
LoopUnrollPass: Use variable "Threshold" instead of "CurrentThreshold" when
  reducing unroll count, otherwise the reduced unroll count is not taking
  the "OptimizeForSize" attribute into account.

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=154007&r1=154006&r2=154007&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp Wed Apr  4 06:44:08 2012
@@ -197,13 +197,13 @@
       }
       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;
         }





More information about the llvm-commits mailing list