> On Sep 14, 2018, at 3:42 PM, Andrew Pinski <pins...@gmail.com> wrote: > > On Fri, Sep 14, 2018 at 1:34 PM Qing Zhao <qing.z...@oracle.com > <mailto: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?
This option is OFF by default, only when explicitly specified by option -finline-only-static, it controls the inliner (including early inliner and ipa inliner) to ONLY inline the static functions. i.e. if the -finline-only-static is specified, GCC only inlines static functions, all global functions will be disabled by inliner. hope this is clear. Qing > > Thanks, > Andrew > >> >> thanks a lot. >> >> Qing >> >> gcc/ChangeLog >> >> +2018-09-13 Qing Zhao <qing.z...@oracle.com <mailto: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 <mailto: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