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: Fix removal of ctors/dtors


Hi,

On Tue, Oct 26, 2010 at 04:16:04PM +0200, Jan Hubicka wrote:
> Finally both inliner and ipa-cp confuse handling of functions with
> address taken.  ipa-cp is considering functions with address taken
> to be cloning candidates.  This is wrong.  We should clone only when
> we think original function is not called at all but we can't say for
> sure since it is externally visible.  Clonning is of course
> possible, but current impementation leads to wrong code when
> updating call sites of calls promoted to be direct.
> 

We have had similar issues before but so far managed to get around
them without such a big hammer.  Do you have a testcase that will fail
if I remove the ipa-cp hunk?

Thanks,

Martin


> Bootstrapped/regtested x86_64-linux, lto-bootstrapped x86_64-linux and tested
> with Firefox builds.   I also tested that tramp3d does not care about the
> inliner mertric fixes.
> 
> Honza
> 
> 	* cgraph.c (cgraph_set_readonly_flag): Rename to...
> 	(cgraph_set_const_flags) ... this one; get also looping argument;
> 	clear constructor/destructor flags.
> 	(cgraph_set_pure_flag): Likewise.
> 	(cgraph_set_looping_const_or_pure_flag): Remove.
> 	(cgraph_can_remove_if_no_direct_calls_and_refs): Do not try
> 	to optimize away static ctors/dtors; it does not work on inline clones;
> 	external functions can always be rmeoved.
> 	(cgraph_will_be_removed_from_program_if_no_direct_calls): Assert on inline
> 	clones; in LTO external functions always can go.
> 	(cgraph_used_from_object_file_p): Handle EXTERNAL functions correctly.
> 	(cgraph_mark_address_taken_node): Assert that we are not taking address of
> 	inline clone.
> 	(cgraph_can_remove_if_no_direct_calls_p): We always eventually remove
> 	external functions.
> 	* ipa-cp.c (ipcp_cloning_candidate_p): Do not clone functions with address taken.
> 	(ipcp_initialize_node_lattices): Only local functions can be handled without cloning.
> 	* cgraph.h (cgraph_set_readonly_flag,
> 	cgraph_set_looping_const_or_pure_flag): Remove.
> 	(cgraph_set_const_flag): Declare.
> 	(cgraph_set_pure_flag): Update.
> 	* ipa-pure-const (propagate_pure_const, local_pure_const): Update
> 	flags setting code.
> 	* ipa.c (cgraph_remove_unreachable_nodes): Fix formating; do not look at inline
> 	clones; fix handling of external definitions.
> 	(cgraph_postorder): Do not look at inline clones in the first pass.
> 	(function_and_variable_visibility): Drop constructors/destructor
> 	flags at pure and const functions.
> 	* tree-profile.c (tree_profiling): Update.
> 	* ipa-inline.c (cgraph_clone_inlined_nodes): Always clone functions with
> 	address taken; external functions do not account to whole program size.
> 	(cgraph_decide_inlining): Likewise; do not try to inline functions already
> 	inlined.
> 
> 	* testsuite/gcc.dg/lto/pr45736_0.c: New function.


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