Teach scalarrepl about address spaces
[oota-llvm.git] / lib / Transforms / Scalar / ScalarReplAggregates.cpp
index 33bbe1516306d9719ae977efa5db24b98d4093b2..57b290e14b130ed8e5efb550a301599c6e87ba89 100644 (file)
@@ -963,7 +963,7 @@ ConvertScalar_InsertValue(Value *SV, Value *Old,
   if (SV->getType()->isFloatingPointTy() || SV->getType()->isVectorTy())
     SV = Builder.CreateBitCast(SV, IntegerType::get(SV->getContext(),SrcWidth));
   else if (SV->getType()->isPointerTy())
-    SV = Builder.CreatePtrToInt(SV, TD.getIntPtrType(SV->getContext()));
+    SV = Builder.CreatePtrToInt(SV, TD.getIntPtrType(SV->getType()));
 
   // Zero extend or truncate the value if needed.
   if (SV->getType() != AllocaType) {