[opaque pointer type] Track explicit GEP pointee type through in-memory IR
[oota-llvm.git] / lib / Transforms / Utils / ValueMapper.cpp
index 5c1518d72aca011cf5dfeceb5bf41bf5bda8cbcd..cac80accc32f4d511598ec244708d3abea44b816 100644 (file)
@@ -400,5 +400,8 @@ void llvm::RemapInstruction(Instruction *I, ValueToValueMapTy &VMap,
   }
   if (auto *AI = dyn_cast<AllocaInst>(I))
     AI->setAllocatedType(TypeMapper->remapType(AI->getAllocatedType()));
+  if (auto *GEP = dyn_cast<GetElementPtrInst>(I))
+    GEP->setSourceElementType(
+        TypeMapper->remapType(GEP->getSourceElementType()));
   I->mutateType(TypeMapper->remapType(I->getType()));
 }