[LLVMdev] Linking modules across contexts crashes

Yuri yuri at rawbw.com
Thu Jun 4 16:34:52 PDT 2015


On 06/04/2015 16:20, Duncan P. N. Exon Smith wrote:
> Note that I don't think this is a small project.  I suspect a fair
> bit of code from the ValueMapper could/should be shared or refactored.
>
> I think the "mutate the module" approach would have some interesting
> corner cases that the "create a new module" approach doesn't, but it's
> probably doable somehow, and I suspect needs roughly the same
> algorithm.

I didn't take such approach, because ValueMapper will only provide the 
old->new mapping, while both Contexts already maintain the maps of the 
same objects. I chose the light approach of only changing the minimal 
set of references necessary to re-map the module to the new context. The 
original question of how to clone ConstantArray is also besides the 
ValueMapper approach. I also wouldn't choose to clone the module, as 
this would defeat the main point: to make it light on CPU. And cloning 
the large objects obviously isn't light.

Yuri



More information about the llvm-dev mailing list