This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][Middle-end][Version 2]Add a new option to control inlining only on static functions
- From: Andrew Pinski <pinskia at gmail dot com>
- To: qing dot zhao at oracle dot com
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jeff Law <law at redhat dot com>, Richard Guenther <rguenther at suse dot de>, Jakub Jelinek <jakub at redhat dot com>, Alexander Monakov <amonakov at ispras dot ru>
- Date: Fri, 14 Sep 2018 13:42:14 -0700
- Subject: Re: [PATCH][Middle-end][Version 2]Add a new option to control inlining only on static functions
- References: <74719178-A2E7-4A65-BB0C-84DD4D3E6B08@oracle.com> <7E5FF9F1-EEBF-436F-B2C7-3A76617004AA@oracle.com>
On Fri, Sep 14, 2018 at 1:34 PM Qing Zhao <qing.zhao@oracle.com> wrote:
>
> Hi,
>
> this is the 2nd version of the patch to add a new first-class option
>
> -finline-only-static
>
> to guide inlining only on static functions.
>
> -finline-only-static
> By default, GCC inlines functions without considering whether they are static
> or not. This flag guides inliner to only inline static functions.
>
> Off by default.
>
> The major purpose of this option is to provide a way for the user to disable inlining of global functions.
> this is mainly to help online patching users to control the memory consumption and ease the debugging.
>
> please take a look and let me know any comments and suggestions:
How does this interact with -finline-functions? Or rather isn't this
just the opposite of -finline-functions?
Thanks,
Andrew
>
> thanks a lot.
>
> Qing
>
> gcc/ChangeLog
>
> +2018-09-13 Qing Zhao <qing.zhao@oracle.com>
> +
> + * cif-code.def (FUNCTION_EXTERN): New CIFCODE.
> + * common.opt (-finline-only-static): New option.
> + * doc/invoke.texi: Document -finline-only-static.
> + * ipa-inline.c (can_inline_edge_p): Control inlining based on
> + function's visibility.
>
> gcc/testsuite/ChangeLog
>
> +2018-09-13 Qing Zhao <qing.zhao@oracle.com>
> +
> + * gcc.dg/inline_only_static.c: New test.
> +
>
>
>
> > On Sep 11, 2018, at 10:12 AM, Qing Zhao <qing.zhao@oracle.com> wrote:
> >
> > Hi,
> >
> > This is a simple patch to add a new first-class option
> >
> > -finline-visibility={all|extern|static}
> >
> > to finer control inlining based on function’s visibility.
> >
> > '-finline-visibility=[all|extern|static]'
> > By default, GCC inlines functions without considering their
> > visibility. This flag allows finer control of inlining based on
> > their visibility.
> >
> > The value 'extern' tells the compiler to only inline functions with
> > external visibility. The value 'static' tells the compiler to only
> > inline functions with static visibility. The value 'all' tells the
> > compilers to inline functions without considering their visibility.
> >
> > The default value of '-finline-visibility' is 'all'.
> >
> > The major purpose of this option is to provide a way for the user
> > to finer choose the inline candidates based on function’s visibility.
> > For example, some online patching users might want to limit the inlining
> > to only static functions to avoid patching the callers of global functions
> > in order to control the memory consumption caused by online patching.
> >
> > let me know any comments and suggestions.
> >
> > thanks.
> >
> > Qing
>