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

--- Comment #9 from Martin Jambor <jamborm at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #6)
> 
> @Martin: Do we have a declaration cloning code for functions somewhere?

See e.g. cgraph_node::create_virtual_clone in cgraphclones.cc.  Unless
you want to mess with the parameters,

  new_decl = copy_node (old_decl);

should be enough (and it should copy over the DECL_PURE and
TREE_READLONY bit soo, I believe).

I am not sure at what point the duplication happens, in order to
duplicate also all the various IPA summaries, cgraph machinery has to
be involved and call all the summary hooks.  So
cgraph_node::create_clone should probably be used (or a part of it, or
perhaps even one of its users?).

Reply via email to