[PATCH] D31001: CloneModule: add an option for a custom LLVMContext

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 14:45:44 PDT 2017


pcc added a comment.

Does this really work? I believe that with this the original and the cloned module will share things like types, which is a violation of the invariant that LLVM IR objects must not be shared between contexts.

When I needed to clone a module into another LLVMContext, I could not see a better way to do it than to serialize it to bitcode and deserialize it into the new LLVMContext (see http://llvm-cs.pcc.me.uk/lib/CodeGen/ParallelCG.cpp).


https://reviews.llvm.org/D31001





More information about the llvm-commits mailing list