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

--- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
I am testing
Index: ../gcc/cgraphclones.c
===================================================================
--- ../gcc/cgraphclones.c       (revision 205737)
+++ ../gcc/cgraphclones.c       (working copy)
@@ -123,7 +123,10 @@ cgraph_clone_edge (struct cgraph_edge *e
     {
       tree decl;

-      if (call_stmt && (decl = gimple_call_fndecl (call_stmt)))
+      if (call_stmt && (decl = gimple_call_fndecl (call_stmt))
+         /* When the call is speculative, we need to resolve it 
+            via cgraph_resolve_speculation and not here.  */
+         && !e->speculative)
        {
          struct cgraph_node *callee = cgraph_get_node (decl);
          gcc_checking_assert (callee);

The problem is that cgraph_clone_edge is too eager to turn the edge into a
direct edge because inliner managed to do the same resolution.
This fixes the ICE but we however ought to do this optimization at IPA level.

Reply via email to