> On Nov 28, 2018, at 9:52 AM, Jan Hubicka <hubi...@ucw.cz> wrote: > >> >> 2018-11-20 qing zhao <qing.z...@oracle.com> >> >> * 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_options_for_live_patching): New function. >> (finish_options): Make flag_live_patching incompatible with flag_lto. >> Control IPA optimizations based on different levels of >> flag_live_patching. >> >> gcc/testsuite/ChangeLog: >> >> 2018-11-20 qing zhao <qing.z...@oracle.com> >> >> * gcc.dg/live-patching-1.c: New test. >> * gcc.dg/live-patching-2.c: New test. >> * gcc.dg/live-patching-3.c: New test. >> * gcc.dg/tree-ssa/writeonly-3.c: New test. >> * gcc.target/i386/ipa-stack-alignment-2.c: New test. >> > > I am still somewhat worried about possible use with C++ programs where > we will kill all inlining of comdats, but I guess we could discuss that > when it becomes an issue.
Okay. If this will be a problem later when we use live-patching in more C++ applications, let’s revisit it at that time. > + > + /* FIXME: disable unreachable code removal. */ > > Disabling unreachable code removal will really introduce a lot of extra > dead code, can't live patches just provide what they need if the code > was earlier removed. > + > + /* discovery of functions/variables with no address taken. */ > + if (opts_set->x_flag_ipa_reference_addressable > + && opts->x_flag_ipa_reference_addressable) > + error_at (loc, > + "%<-fipa-reference-addressable%> is incompatible with " > + "%<-flive-patching=inline-only-static|inline-clone%>"); > + else > + opts->x_flag_ipa_reference_addressable = 0; > + > + /* ipa stack alignment propagation. */ > + if (opts_set->x_flag_ipa_stack_alignment > + && opts->x_flag_ipa_stack_alignment) > + error_at (loc, > + "%<-fipa-stack-alignment%> is incompatible with " > + "%<-flive-patching=inline-only-static|inline-clone%>"); > + else > + opts->x_flag_ipa_stack_alignment = 0; > > Shall we also disable nothrow or we will worry about C++ only ter? This is also mainly for C++ applications, so currently should not be a problem. But I can add a separate simple patch to add another flag to control nothrow propagation and disable it when -flive-patching is ON. > > Patch is OK, thanks for the review. I will commit the patch very soon. Qing > thanks! > Honza