PATCH: Refactor the inliner threshold settings into a function

Eli Bendersky eliben at google.com
Wed Mar 12 09:37:54 PDT 2014


On Wed, Mar 12, 2014 at 7:51 AM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> +int computeThresholdFromOptLevels(unsigned OptLevel, unsigned
> SizeOptLevel)
>
> Make it static for clarity. The function could probably early returns:
>
> if (OptLevel > 2)
>   return 275;
> if (SizeOptLevel == 1)
>   return 75;
> if (SizeOptLevel == 2)
>   return 25;
> return 225;
>
>
Yeah, the original code is definitely convoluted. I chose to keep it in the
initial patch to make it more obvious that I don't change any
functionality. But the actual commit follows your reordering advice.


> LGTM with that.
>

Thanks for the review.

r203669
and in Clang - r203673

Eli



>
> On 11 March 2014 18:59, Eli Bendersky <eliben at google.com> wrote:
> > Hello,
> >
> > There's a bit of duplicated "magic" code in opt.cpp and Clang's CodeGen
> that
> > computes the inliner threshold from opt level and size opt level.
> >
> > This patch moves the code to a function that lives alongside the inliner
> > itself, providing a convenient overload to the inliner creation.
> >
> > A separate patch can be committed to Clang to use this once it's
> committed
> > to LLVM. Standalone tools that use the inlining pass can also avoid
> > duplicating this code and fearing it will go out of sync.
> >
> > PTAL,
> > Eli
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140312/b430648d/attachment.html>


More information about the llvm-commits mailing list