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: [PATCH] Make devirtualization use BINFO_VTABLE instead of BINFO_VIRTUALS


Hi,

On Thu, Sep 01, 2011 at 08:52:30PM +0200, Jan Hubicka wrote:
> > - Nevertheless, this method of devirtualization cannot automatically
> >   de-thunkize this-adjusting thunks and newly direct calls to them
> >   cannot be inlined because the inliner does not have this capability
> >   now.  This is in fact a regression from 4.6, and testcases
> >   ivinline-7.C and ivinline-9.C had to be XFAILed exactly for this
> >   reason.  The size of the memory savings and the fact that we do not
> >   devirtualize that much now make this an acceptable tradeoff, though.
> 
> OK, the "dethunkization" was ugly anyway.  I guess we will need to add support
> for handling thunks in inliner but that can go incrementally.

Do we actually have the offsets and indices necessary for
de-thunkization available somewhere in the middle end structures (with
BINFO_VIRTUALs being freed in free_lang_data now)?

> 
> > 2011-08-31  Martin Jambor  <mjambor@suse.cz>
> > 
> > 	* cgraph.h (cgraph_indirect_call_info): Removed field thunk_delta.
> > 	* gimple-fold.c (gimple_get_virt_method_for_binfo): Rewritten to use
> > 	BINFO_VTABLE.  Parameter delta removed, all callers updated.
> > 	* tree.c (free_lang_data_in_binfo): Clear BINFO_VIRTUALs instead
> > 	BINFO_VTABLE.
> > 	* cgraph.c (cgraph_make_edge_direct): Removed parameter delta, updated
> > 	all calls.
> > 	* cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Removed
> > 	handling of thunk_delta.
> > 	* ipa-cp.c (get_indirect_edge_target): Removed parameter delta.
> > 	(devirtualization_time_bonus): Do not handle thunk deltas.
> > 	(ipcp_discover_new_direct_edges): Likewise.
> > 	* ipa-prop.c (ipa_make_edge_direct_to_target): Likewise.
> > 	(try_make_edge_direct_simple_call): Likewise.
> > 	(try_make_edge_direct_virtual_call): Likewise.
> > 	* lto-cgraph.c (output_cgraph_opt_summary_p): Likewise.  Mark
> > 	parameter set as unused.
> > 	(output_edge_opt_summary): Likewise.  Mark both parameters as unused.
> > 	* lto-cgraph.c (output_cgraph_opt_summary_p): Likewise.  Mark
> > 	parameter set as unused.
> > 	(output_edge_opt_summary): Likewise.  Mark both parameters as unused.
> > 	(input_edge_opt_summary): Likewise.
> > 	* lto-streamer-out.c (lto_output_ts_binfo_tree_pointers): Do not stream
> > 	BINFO_VIRTUALS at all.
> > 	* lto-streamer-in.c (lto_input_ts_binfo_tree_pointers): Likewise.
> > 
> > 	* testsuite/g++.dg/ipa/devirt-3.C: Added a distraction method.
> > 	* testsuite/g++.dg/ipa/ivinline-7.C: Added a test for direct call
> > 	discovery, xfailed test for inlining.
> > 	* testsuite/g++.dg/ipa/ivinline-9.C: Likewise.
> 
> The cgraph bits of the patch are OK, but I will leave the gimple-fold bits for Richi's approval.
> Can't we drop computation of BINFO_VIRTUALS from C++ FE completely now?
> 

I do not think so.  I do not really understand the FE but it seems
to me it is used internally to accumulate what needs to be in the VMT
which is then itself produced by iterating the list in
build_vtbl_initializer.  But I might be wrong. 

I have just committed the patch, thanks,

Martin


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