1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00

Remove the last use of getUnsignedVersion and getSignedVersion from VMCore.

ConstantInt doesn't care about the sign of the type it represents. It only
cares about the bitwidth so there is no need to make the sign of the type
match the SExt or ZExt constant expression.

llvm-svn: 32646
This commit is contained in:
Reid Spencer 2006-12-18 01:11:03 +00:00
parent 142f27dfd4
commit 9ac4a6b7d0

View File

@ -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<ConstantInt>(V))
V = ConstantInt::get(SrcTy->getUnsignedVersion(),
cast<ConstantIntegral>(V)->getZExtValue());
V = ConstantInt::get(SrcTy, cast<ConstantIntegral>(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<ConstantInt>(V))
V = ConstantInt::get(SrcTy->getSignedVersion(),
cast<ConstantIntegral>(V)->getSExtValue());
V = ConstantInt::get(SrcTy, cast<ConstantIntegral>(V)->getSExtValue());
else if (const ConstantBool *CB = dyn_cast<ConstantBool>(V))
V = ConstantInt::get(Type::SByteTy, CB->getValue() ? -1 : 0);