On Tue, Mar 26, 2019 at 5:25 PM Qing Zhao <qing.z...@oracle.com> wrote: > > Hi, Richard, > > thanks for the suggestion. > > I tried it yesterday, but it did not work. > > the reason is: > > inside “can_inline_edge_by_limits_p”, the “allowance for always_inline” is > guarded by the following condition: > > else if “caller_tree != callee_tree” > > this condition is ONLY true when when callee has different optimization level > than the caller. > > So, I think that the correct spot for the checking of > live-patching=inline-only-static should still be inside “can_inline_edge_p”. > > so my previous patch for this bug should be fine. > > what’s your opinion?
You could still move it after the following? /* Check if caller growth allows the inlining. */ if (!DECL_DISREGARD_INLINE_LIMITS (callee->decl) && !disregard_limits && !lookup_attribute ("flatten", DECL_ATTRIBUTES (caller->decl)) && !caller_growth_limits (e)) inlinable = false; that said, looking at DECL_DISREGARD_INLINE_LIMITS in can_inline_edge_p looks wrong. Richard. > thanks. > > Qing > > > On Mar 25, 2019, at 7:23 AM, Richard Biener <richard.guent...@gmail.com> > > wrote: > > > > On Wed, Mar 20, 2019 at 4:16 PM Qing Zhao <qing.z...@oracle.com> wrote: > >> > >> Hi, > >> > >> there is a bug in the current support for > >> -flive-patching=inline-only-static: > >> > >> it rejects inlining of external always_inline routine, therefore triggers > >> a compilation time error. > >> > >> we should always inline “always_inline” routines. > >> > >> please review the following simple patch, it has been bootstrapped and > >> regression tested on aarch64. > >> > >> Okay for committing? > > > > To me this seems like can_inline_edge_p was the wrong spot to disable > > inlining > > for -flive-patching=inline-only-static and instead it should have been in > > can_inline_edge_by_limits_p which already has proper allowance for > > always-inline. > > > > So can you move the check there, like after > > > > /* gcc.dg/pr43564.c. Apply user-forced inline even at -O0. */ > > else if (always_inline) > > ; > > > > ? > > > >> thanks. > >> > >> Qing. > >> > >> gcc/ChangeLog: > >> > >> 2019-03-20 qing zhao <qing.z...@oracle.com> > >> > >> PR tree-optimization/89730 > >> * ipa-inline.c (can_inline_edge_p): Grant always_inline even when > >> -flive-patching=inline-only-static. > >> > >> gcc/testsuite/ChangeLog: > >> > >> 2019-03-20 qing zhao <qing.z...@oracle.com> > >> > >> * gcc.dg/live-patching-4.c: New test. > >> >