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] Fix comdat optimized same body virtual destructors (PR c++/42317)


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


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