diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 170df732723..32414721a7f 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -875,16 +875,14 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V, // A ZExt always produces an unsigned value so we need to cast the value // now before we try to cast it to the destination type if (isa(V)) - V = ConstantInt::get(SrcTy->getUnsignedVersion(), - cast(V)->getZExtValue()); + V = ConstantInt::get(SrcTy, cast(V)->getZExtValue()); break; case Instruction::SIToFP: case Instruction::SExt: // A SExt always produces a signed value so we need to cast the value // now before we try to cast it to the destiniation type. if (isa(V)) - V = ConstantInt::get(SrcTy->getSignedVersion(), - cast(V)->getSExtValue()); + V = ConstantInt::get(SrcTy, cast(V)->getSExtValue()); else if (const ConstantBool *CB = dyn_cast(V)) V = ConstantInt::get(Type::SByteTy, CB->getValue() ? -1 : 0);