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

Alex Denisov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 14:58:00 PDT 2017


AlexDenisov 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.

Well, it works in our case, but now I see that it may have a problem in other cases.

> 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).

This is a good idea. I think we must go the same way.

Thank you for your hint and the fast response :)


https://reviews.llvm.org/D31001





More information about the llvm-commits mailing list