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

--- Comment #4 from Martin Jambor <jamborm at gcc dot gnu.org> ---
And the reason is not copying tree_map in cgraph_node::create_clone
(when called from clone_inlined_nodes).  The following should fix it.
In theory we need a mechanism for create_virtual_clone to create_clone
that it has a new tree_map for the clone but since IPA-CP is the only
pass creating new tree_maps now, it is not a real inefficiency, at
least not yet.


diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index b5793f90b64..aa16a9efbec 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -409,6 +409,9 @@ cgraph_node::create_clone (tree new_decl, profile_count
prof_count,
   new_node->merged_extern_inline = merged_extern_inline;
   clone_info *info = clone_info::get (this);

+  if (info && info->tree_map)
+    clone_info::get_create (new_node)->tree_map
+      = vec_safe_copy (info->tree_map);
   if (param_adjustments)
     clone_info::get_create (new_node)->param_adjustments = param_adjustments;
   else if (info && info->param_adjustments)

Reply via email to