[LLVMdev] Use list preservation when using Instruction::clone

Jingyue Wu jingyue at google.com
Thu Oct 2 15:26:50 PDT 2014

Hi Tyler,

Doesn't look right. Would you mind attaching the test?

Btw, instead of creating an empty function and CloneFunctionInto, can you
just CloneFunction?


On Thu Oct 02 2014 at 2:47:51 PM Tyler Denniston <tyler at csail.mit.edu>

> I'm trying to create a clone of a function using Function::Create()
> and CloneFunctionInto. However, I'm running into an issue. I believe
> that the instructions in the function clone still have Use edges to
> values in the original function. This is a problem for my purposes.
> For example, consider an original function F. I create a new function
> G belonging to the same module and call CloneFunctionInto(G, F) to
> copy over the function body. Now, consider a phi node p in F, and an
> instruction I in F which uses p. The problem is, the cloned phi node
> p' in G still lists I as a user.
> Is this intended behavior? And if so, is there a way I can remove
> these Use edges in my cloned function?
> Thanks,
> Tyler
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141002/83d72c93/attachment.html>

More information about the llvm-dev mailing list