[LLVMdev] Use list preservation when using Instruction::clone (original) (raw)

Tyler Denniston tyler at csail.mit.edu
Thu Oct 2 14:45:21 PDT 2014


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



More information about the llvm-dev mailing list