[llvm-dev] Cloning a function from one module to another module

James Courtier-Dutton via llvm-dev llvm-dev at lists.llvm.org
Wed Jun 13 02:31:59 PDT 2018


Hi,

Say I have loaded two .bc files into memory so that I have 2 modules.
How could I clone a function from one module into the other module.

I have looked at:
Function *CloneFunction(Function *F, ValueToValueMapTy &VMap,
  ClonedCodeInfo *CodeInfo = nullptr);

But I think that only clones within the same Module, not between modules.
I believe the clone between modules will take more effort, because all
the associated types will need to also be cloned if they are not
already in the destination module.

I can implement this myself, but I wished to check that it had not
already been done before.

Kind Regards

James


More information about the llvm-dev mailing list