------- Comment #6 from rguenth at gcc dot gnu dot org  2009-12-04 13:00 -------
So we come in

tree-inline.c:

1695                      if (id->transform_call_graph_edges ==
CB_CGE_MOVE_CLONES)
1696                        cgraph_create_edge_including_clones

as we figure out a new direct call.  But while
cgraph_create_edge_including_clones
creates a new edge with CIF_ORIGINALLY_INDIRECT_CALL failed reason it does
not create a new clone for the callee even though the callee has
global.inlined_to set (though it isn't a clone appearantly:

A* A::fooA()/7(-1) @0xb7cb9924 (inline copy in void baz()/1)
availability:available 17 time, 12 benefit 6 size, 3 benefit reachable body
finalized inlinable
  called by: void B<<anonymous> >::fooB(char) [with int <anonymous> = 0]/5
(1.00 per call) (can throw external) void B<<anonymous> >::fooB(char) [with int
<anonymous> = 0]/6 (1.00 per call) (inlined) (can throw external) 
  calls: bool foo()/4 (1.00 per call) (can throw external) bool foo()/4 (0.39
per call) (can throw external) 

so we shouldn't create a new direct call edge to an inline-copy node but
to it's real node.  Somehow.  Maybe we removed that node already?
Indeed.  We remove it's clone_of here:

Breakpoint 7, cgraph_remove_node (node=0xb7cb9384)
    at /home/richard/src/trunk/gcc/cgraph.c:1282
gdb) up
#1  0x08ae1705 in cgraph_remove_unreachable_nodes (before_inlining_p=0 '\000', 
    file=0x0) at /home/richard/src/trunk/gcc/ipa.c:213
213                 cgraph_remove_node (node);
(gdb) 
#2  0x08ab1fd1 in cgraph_optimize ()
    at /home/richard/src/trunk/gcc/cgraphunit.c:1791
1791      cgraph_remove_unreachable_nodes (false, dump_file);
(gdb) 
#3  0x08aaf8e5 in cgraph_finalize_compilation_unit ()
    at /home/richard/src/trunk/gcc/cgraphunit.c:1083
1083      cgraph_optimize ();

and the callee node looks like this before we proceed with removing:

A* A::fooA()/7(-1) @0xb7cb9924 (inline copy in void baz()/1) (clone of A*
A::fooA()/0) availability:available 17 time, 12 benefit 6 size, 3 benefit
reachable body finalized inlinable
  called by: void B<<anonymous> >::fooB(char) [with int <anonymous> = 0]/6
(1.00 per call) (inlined) (can throw external) 
  calls: bool foo()/4 (1.00 per call) (can throw external) bool foo()/4 (0.39
per call) (can throw external) 

no idea if keeping the clone_of would have magically solved the problem
here.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42110

Reply via email to