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

Hongbin Zheng etherzhhb at gmail.com
Wed Apr 4 05:24:29 PDT 2012


Hi,

On Wed, Apr 4, 2012 at 8:07 PM, Hongbin Zheng <etherzhhb at gmail.com> wrote:
> Hi tobi,
>
> It looks like a trivial typo [1],  as you can find the comment of "Threshold":
>
>  // Determine the current unrolling threshold.  While this is normally set
>  // from UnrollThreshold, it is overridden to a smaller value if the current
>  // function is marked as optimize-for-size, and the unroll threshold was
>  // not user specified.
>  unsigned Threshold = CurrentThreshold;
>  if (!UserThreshold &&
>      Header->getParent()->hasFnAttr(Attribute::OptimizeForSize))
>    Threshold = OptSizeUnrollThreshold;
I think here it should use

Threshold = std::min(OptSizeUnrollThreshold, Threshold);

Otherwise users are not able unroll the loop with a threshold that is
small than OptSizeUnrollThreshold for function with "OptimizeForSize"
attribute option.

We can also provide a command line option to allow users to assign the
value of OptSizeUnrollThreshold.

best regards
ether




More information about the llvm-commits mailing list