> On Sep 14, 2018, at 3:45 PM, Andrew Pinski <pins...@gmail.com> wrote: > > On Fri, Sep 14, 2018 at 1:42 PM Andrew Pinski <pins...@gmail.com > <mailto:pins...@gmail.com>> wrote: >> >> On Fri, Sep 14, 2018 at 1:34 PM Qing Zhao <qing.z...@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? > > Seems to me, that this new option should just disable > -finline-small-functions and -finline-functions. > That is it is an alias with -fno-inline-small-functions -fno-inline-functions.
NO, this option is NOT to disable -finline-small-funcitons and -finline-functions. when it’s specified, -finline-small-function and -finline-functions will ONLY inline static functions, all global functions will be disabled to be inlined. Qing > > My question comes up if someone uses -finline-functions > -finline-only-static; or -finline-only-static -finline-functions. > That it is a rather interesting combition of options but the > interaction of the two options are not documented and seems backwards. > > Thanks, > Andrew Pinski > >> >> Thanks, >> Andrew >> >>> >>> thanks a lot. >>> >>> Qing >>> >>> gcc/ChangeLog >>> >>> +2018-09-13 Qing Zhao <qing.z...@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.z...@oracle.com> >>> + >>> + * gcc.dg/inline_only_static.c: New test. >>> + >>> >>> >>> >>>> On Sep 11, 2018, at 10:12 AM, Qing Zhao <qing.z...@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