[LLVMdev] CloneFunctionInto/MapValue, problem when VMap changes type

Sharlet, Dillon dillon.sharlet at intel.com
Tue Jan 15 17:28:31 PST 2013

Hello All,

I am having a problem with using CloneFunctionInto to clone a function that includes changing the type of a value using the VMap. Specifically, I am using the VMap to change the address space of values that have particular pointer types.

The problem seems to be that RemapInstruction successfully changes the operands using the VMap, but the VTy member indicating the type of the instruction does not change to reflect the new types. In my case, this manifests itself as a GetElementPtr instruction (among others) that is accessing a value with a pointer in address space 1, but getType() returns a pointer in address space 0 (the types match otherwise).

Unfortunately, I don't see any way to fix this without duplicating the logic for getting the VTy for each class of instruction. I am wondering if someone more familiar with this functionality might have a better idea of how to fix this? 


More information about the llvm-dev mailing list