> Hello,
> In my transformation of an input program, I need to clone functions
> and the callee functions in each clone.  To clone a function, or
> create a duplicate, I use "cgraph_function_versioning()"  This works
> perfectly well for the parent function.  I then go through the
> statements in the parent and look for any function calls (callees).
> If I find a function call, I clone that function and update the call
> site using "gimple_call_set_fn()"  Now, when I dump the gimple via
> "debug_function()" I see everything as I expect (parent-clone calls
> all the callee-clones).  The parent and all of its callees are the
> clones I want.  However, when GCC finishes compiling things, the
> callee clones are no where to be found.  And the original (non-clone)
> calleess are being used.  The parent-clone is there but all of the
> callsites are using the original callees and not the clones.  I know
> there must be some update routine, (rebuild_cgraph_edges() did not
> help) to glue the callee clones in place so that they do not revert
> back to the original callee.

Hi,
it seems that you are not redirecting the calls to the newly formed clone,
so the clones gets optimized out. 
You can look at cgraph_redirect_edge_callee uses in ipa-cp to see how this
is done.

Note that there are two mechanizms for clonning functions, the real
clones you use and virtual clones. It depends on what you are trying to
do on what is better for you. Can you elaborate more on your pass?

Honza
> 
> I hope I haven't been too confusing, I do appreciate any help if possible.
> 
> -Matt

Reply via email to