[PATCH] Teach InlineCost to account for a null check which can be folded away

Chandler Carruth chandlerc at gmail.com
Fri Apr 24 16:55:40 PDT 2015


FYI, returning from vacs and travel next week. This will be on my queue.

On Sat, Apr 25, 2015, 00:23 Philip Reames <listmail at philipreames.com> wrote:

> ping.
>
> On 04/20/2015 02:45 PM, Philip Reames wrote:
> > Hi chandlerc, nlewycky,
> >
> > If we have a caller that knows a particular argument can never be null,
> we can exploit this fact while simplifying values in the inline cost
> analysis.  This has the effect of reducing the cost for inlining when a
> null check is present in the callee, but the value is known non null in the
> caller.  In particular, any dependent control flow can be discounted from
> the cost estimate.
> >
> > Note that this is only adjusting the inline cost analysis.  As separate
> changes, I'm going to add support for propagating the null attribute to the
> call site.  An alternate approach would be the have the inline cost
> analysis ask a ValueTracking question about the caller's formal argument.
> Separating this into two pieces using the already existing nonnull
> attribute seemed preferable.
> >
> > Does anyone think I need to teach InlineFunction to exploit the
> attribute in the same way?  Or are we willing to assume this will happen
> correctly after inlining?
> >
> > http://reviews.llvm.org/D9129
> >
> > Files:
> >    lib/Analysis/IPA/InlineCost.cpp
> >    test/Transforms/Inline/nonnull.ll
> >
> > EMAIL PREFERENCES
> >    http://reviews.llvm.org/settings/panel/emailpreferences/
>
> _______________________________________________
> 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/20150424/82806bc8/attachment.html>


More information about the llvm-commits mailing list