This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix comdat optimized same body virtual destructors (PR c++/42317)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: Jason Merrill <jason at redhat dot com>, Richard Guenther <rguenther at suse dot de>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 8 Dec 2009 16:24:58 -0500
- Subject: Re: [PATCH] Fix comdat optimized same body virtual destructors (PR c++/42317)
- References: <20091207182839.GR22813@hs20-bc2-1.build.redhat.com> <20091208153519.GA21863@kam.mff.cuni.cz>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
On Tue, Dec 08, 2009 at 04:35:20PM +0100, Jan Hubicka wrote:
> I believe you will also need to teach cgraph_can_remove_if_node_direct_calls_p
> to get right that node can stay available only because other node in same
> group exists.
I've looked at cgraph_can_remove_if_no_direct_calls_p. It is used in 3
places:
1) in cgraph_remove_unreachable_nodes making that function return false
for nodes with same_comdat_group would be harmful, suddenly all those
dtors wouldn't be reclaimed as unreachable if nothing calls any of the
dtors. What the function currently does works - i.e. don't look at
same_comdat_group in the first cycle, but in the second cycle whenever
some node is reachable, mark all its same_comdat_group siblings as also
reachable
2) in cgraph_clone_inlined_nodes - here I believe we want to
if (!e->callee->callers->next_caller
&& cgraph_can_remove_if_no_direct_calls_p (e->callee)
+ && !e->callee->same_comdat_group
&& !cgraph_new_nodes)
i.e never reuse for the 2+ fn comdat groups (and the patch wasn't doing
that)
3) in cgraph_mark_inline_edge, I think that has to match
cgraph_clone_inlined_nodes, so it would be
if (e->callee->callers->next_caller
|| !cgraph_can_remove_if_no_direct_calls_p (e->callee)
+ || e->callee->same_comdat_group)
duplicate = true;
Is that ok? I'll bootstrap/regtest it momentarily.
Jakub