This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PR 82027] Also stream opt_info of former_clones


On 12/21/2017 02:50 PM, Martin Jambor wrote:
> Hi,
> 
> the problem in PR 82027 is a general one with thunks that are created
> for IPA-CP clones.  At WPA time, IPA-CP creates a clone that is called
> through a thunk.  An "artificial thunk" is created in
> duplicate_thunk_for_node() in cgraphclones.c.  This function also
> removes now unnecessary arguments from DECL_ARGUMENTS of the new thunk.
> The node gets appropriate args_to_skip so that its call-sites also get
> the counterpart actual arguments removed at inline transform time.
> Because the artificial thunk is not a virtual clone, it is created with
> clone_of NULL and former_clone_of set to the original thunk.
> 
> Unfortunately, NULL clone_of means that output_cgraph_opt_summary_p()
> returns false for the new artificial_thunk and therefore its
> args_to_skip is not streamed and is lost.  At inline transform time, we
> do not remove the counterpart actual arguments and we end up with
> argument mismatch.
> 
> The patch below fixes this by streaming args_to_skip also of former
> clones, which brings LTO in-line with non-LTO.  At WPA time, the only
> nodes with non-NULL former_clone_of are artificial thunks created by
> duplicate_thunk_for_node(), so it does not grow the streamed IL
> unnecessarily.
> 
> Unfortunately, I do not remember why we have decided not to create
> clones of thunks as virtual clones, which would be arguably a more
> natural fix.  Perhaps those reasons no longer apply and in gcc 9 we
> could do that.  However, for GCC 8, 7 and 6, I would prefer this small
> non-intrusive one.
> 
> Bootstrapped and tested on x86_64-linux, I will attempt an LTO bootstrap
> overnight, OK for trunk, gcc 7 and gcc 6 if it passes?
> 
> Thanks,
> 
> Martin
> 
> 
> 2017-12-21  Martin Jambor  <mjambor@suse.cz>
> 
> 	PR lto/82027
> 	* lto-cgraph.c (output_cgraph_opt_summary_p): Also check former
> 	clones.
> 
> testsuite/
> 	* g++.dg/lto/pr82027_0.C: New test.
OK.
jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]