is larger. Adjust so that it truncates to pointer width, only if necessary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34954
91177308-0d34-0410-b5e6-
96231b3b80d8
GenericValue Dest, Src = getOperandValue(SrcVal, SF);
assert(isa<PointerType>(DstTy) && "Invalid PtrToInt instruction");
- Dest.PointerVal = (PointerTy) Src.IntVal.trunc(64).getZExtValue();
+ uint32_t PtrSize = TD.getPointerSize();
+ if (PtrSize != Src.IntVal.getBitWidth())
+ Src.IntVal = Src.IntVal.trunc(PtrSize);
+
+ Dest.PointerVal = (PointerTy) Src.IntVal.getZExtValue();
return Dest;
}