https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93621

--- Comment #16 from Martin Jambor <jamborm at gcc dot gnu.org> ---
The following workaround works for the testcase but would need to be
generalized for a chain of former_decl_of's to be universal, I'm afraid:

diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 6b780f80eb3..241b996151a 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -1467,7 +1467,8 @@ cgraph_edge::redirect_call_stmt_to_callee (cgraph_edge
*e)


   if (e->indirect_unknown_callee
-      || decl == e->callee->decl)
+      || decl == e->callee->decl
+      || decl == e->callee->former_clone_of)
     return e->call_stmt;

   if (flag_checking && decl)
diff --git a/gcc/ipa-inline-transform.c b/gcc/ipa-inline-transform.c
index eed992d314d..a6675768552 100644
--- a/gcc/ipa-inline-transform.c
+++ b/gcc/ipa-inline-transform.c
@@ -588,6 +588,7 @@ save_inline_function_body (struct cgraph_node *node)
       first_clone->next_sibling_clone = NULL;
       gcc_assert (!first_clone->prev_sibling_clone);
     }
+  first_clone->former_clone_of = node->decl;
   first_clone->clone_of = NULL;

   /* Now node in question has no clones.  */

Reply via email to