Index: include/llvm/ExecutionEngine/ExecutionEngine.h =================================================================== --- include/llvm/ExecutionEngine/ExecutionEngine.h +++ include/llvm/ExecutionEngine/ExecutionEngine.h @@ -384,11 +384,8 @@ const GlobalValue *getGlobalValueAtAddress(void *Addr); /// StoreValueToMemory - Stores the data in Val of type Ty at address Ptr. - /// Ptr is the address of the memory at which to store Val, cast to - /// GenericValue *. It is not a pointer to a GenericValue containing the - /// address at which to store Val. - void StoreValueToMemory(const GenericValue &Val, GenericValue *Ptr, - Type *Ty); + /// Ptr is the address of the memory at which to store Val. + void StoreValueToMemory(const GenericValue &Val, void *Ptr, Type *Ty); void InitializeMemory(const Constant *Init, void *Addr); Index: lib/ExecutionEngine/ExecutionEngine.cpp =================================================================== --- lib/ExecutionEngine/ExecutionEngine.cpp +++ lib/ExecutionEngine/ExecutionEngine.cpp @@ -355,14 +355,12 @@ Dest[Size-1] = 0; // Endian safe: Array[i] = (PointerTy)Dest; - EE->StoreValueToMemory(PTOGV(Dest.get()), - (GenericValue*)(&Array[i*PtrSize]), SBytePtr); + EE->StoreValueToMemory(PTOGV(Dest.get()), &Array[i * PtrSize], SBytePtr); Values.push_back(std::move(Dest)); } // Null terminate it - EE->StoreValueToMemory(PTOGV(nullptr), - (GenericValue*)(&Array[InputArgv.size()*PtrSize]), + EE->StoreValueToMemory(PTOGV(nullptr), &Array[InputArgv.size() * PtrSize], SBytePtr); return Array.get(); } @@ -1045,8 +1043,8 @@ } } -void ExecutionEngine::StoreValueToMemory(const GenericValue &Val, - GenericValue *Ptr, Type *Ty) { +void ExecutionEngine::StoreValueToMemory(const GenericValue &Val, void *Ptr, + Type *Ty) { const unsigned StoreBytes = getDataLayout().getTypeStoreSize(Ty); switch (Ty->getTypeID()) { @@ -1068,7 +1066,7 @@ case Type::PointerTyID: // Ensure 64 bit target pointers are fully initialized on 32 bit hosts. if (StoreBytes != sizeof(PointerTy)) - memset(&(Ptr->PointerVal), 0, StoreBytes); + memset(Ptr, 0, StoreBytes); *((PointerTy*)Ptr) = Val.PointerVal; break; @@ -1227,7 +1225,7 @@ if (Init->getType()->isFirstClassType()) { GenericValue Val = getConstantValue(Init); - StoreValueToMemory(Val, (GenericValue*)Addr, Init->getType()); + StoreValueToMemory(Val, Addr, Init->getType()); return; } Index: lib/ExecutionEngine/Interpreter/Execution.cpp =================================================================== --- lib/ExecutionEngine/Interpreter/Execution.cpp +++ lib/ExecutionEngine/Interpreter/Execution.cpp @@ -1049,8 +1049,7 @@ ExecutionContext &SF = ECStack.back(); GenericValue Val = getOperandValue(I.getOperand(0), SF); GenericValue SRC = getOperandValue(I.getPointerOperand(), SF); - StoreValueToMemory(Val, (GenericValue *)GVTOP(SRC), - I.getOperand(0)->getType()); + StoreValueToMemory(Val, GVTOP(SRC), I.getOperand(0)->getType()); if (I.isVolatile() && PrintVolatile) dbgs() << "Volatile store: " << I; }