> On 11/16/18 2:36 AM, Qing Zhao wrote: > > Hi, > > > > this is the new version of the patch. > > > > I have bootstrapped it on both aarch64 and x86, no regression. > > > > please take a look. > > Thanks for the updated version of the patch. > I have last small nits I see: > > - gcc/common.opt: when running --help=common, the line is too long > - gcc/doc/invoke.texi - 2 spaces in between sentences + better gol > - gcc/opts.c - do not mix spaces + tabs > > With that I'm fine. But note that I'm not a maintainer :) I wonder what happens, when I pass like -flive-patching -fwhole-program compared to -fwhole-program -flive-patching. It seems to me that in first case we will end up with whole-program optimization while in the second we won't. I guess we should behave in a way that we disable the passes when they are enabled implicitly (such as by -O2) but output an error when once uses contradicting set of options, lie -flive-patching -fwhole-program? Honza > > Thanks, > Martin > > > > > Okay for commit? > > > > thanks. > > > > Qing > > > > ================================== > > > > gcc/ChangeLog: > > > > 2018-11-15 qing zhao <qing.zhao@xxxxxxxxxx> > > > > * cif-code.def (EXTERN_LIVE_ONLY_STATIC): New CIF code. > > * common.opt: Add -flive-patching flag. > > * doc/invoke.texi: Document -flive-patching. > > * flag-types.h (enum live_patching_level): New enum. > > * ipa-inline.c (can_inline_edge_p): Disable external functions from > > inlining when flag_live_patching is LIVE_PATCHING_INLINE_ONLY_STATIC. > > * opts.c (control_optimizations_for_live_patching): New function. > > (finish_options): Make flag_live_patching incompatible with flag_lto. > > (common_handle_option): Handle flive-patching flag. > > > > gcc/testsuite/ChangeLog: > > > > 2018-11-15 qing zhao <qing.zhao@xxxxxxxxxx> > > > > * gcc.dg/live-patching-1.c: New test. > > * gcc.dg/live-patching-2.c: New test. > > * gcc.dg/tree-ssa/writeonly-3.c: New test. > > * gcc.target/i386/ipa-stack-alignment-2.c: New test. > > > From e44d8b88ac5fb712d5b5e7fdf2f2ad7f43b8ea09 Mon Sep 17 00:00:00 2001 > From: marxin <mliska@xxxxxxx> > Date: Fri, 16 Nov 2018 16:23:44 +0100 > Subject: [PATCH] my fixes. > > --- > gcc/common.opt | 3 +-- > gcc/doc/invoke.texi | 8 ++++---- > gcc/opts.c | 2 +- > 3 files changed, 6 insertions(+), 7 deletions(-) > > diff --git a/gcc/common.opt b/gcc/common.opt > index 63cd6cc851d..35c24b8e8cf 100644 > --- a/gcc/common.opt > +++ b/gcc/common.opt > @@ -2187,8 +2187,7 @@ Common RejectNegative Alias(flive-patching=,inline-clone) Optimization > flive-patching= > Common Report Joined RejectNegative Enum(live_patching_level) Var(flag_live_patching) Init(LIVE_PATCHING_NONE) Optimization > -flive-patching=[inline-only-static|inline-clone] Control IPA > -optimizations to provide a safe compilation for live-patching. At the same > -time, provides multiple-level control on the enabled IPA optimizations. > +optimizations to provide a safe compilation for live-patching. > > Enum > Name(live_patching_level) Type(enum live_patching_level) UnknownError(unknown Live-Patching Level %qs) > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi > index 0fb67163490..9cccc4455fa 100644 > --- a/gcc/doc/invoke.texi > +++ b/gcc/doc/invoke.texi > @@ -9288,13 +9288,13 @@ impacted function of the former. If a function is patched, its impacted > functions should be patched too. > > The impacted functions are decided by the compiler's interprocedural > -optimizations. For example, inlining a function into its caller, cloning > +optimizations. For example, inlining a function into its caller, cloning > a function and changing its caller to call this new clone, or extracting > a function's pureness/constness information to optimize its direct or > indirect callers, etc. > > Usually, the more IPA optimizations enabled, the larger the number of > -impacted functions for each function. In order to control the number of > +impacted functions for each function. In order to control the number of > impacted functions and computed the list of impacted function easily, > we provide control to partially enable IPA optimizations on two different > levels. > @@ -9313,8 +9313,8 @@ callers need to be patched as well. > @option{-flive-patching=inline-clone} disables the following optimization flags: > @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol > -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol > --fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol > --fipa-stack-alignment} > +-fipa-bit-cp -fipa-vrp -fipa-pure-const @gol > +-fipa-reference-addressable -fipa-stack-alignment} > > @item inline-only-static > > diff --git a/gcc/opts.c b/gcc/opts.c > index 570155816e3..0b5e89faeee 100644 > --- a/gcc/opts.c > +++ b/gcc/opts.c > @@ -2347,7 +2347,7 @@ common_handle_option (struct gcc_options *opts, > > case OPT_flive_patching_: > if (value) > - control_optimizations_for_live_patching (opts, opts_set, > + control_optimizations_for_live_patching (opts, opts_set, > opts->x_flag_live_patching); > break; > > -- > 2.19.1 >