aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-18 01:11:03 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-18 01:11:03 +0000
commitd54d8fa45a1f189580934259fcac3fc3c663810e (patch)
treee9e68fa770964edde16586774e7418663a57e9f1
parentb1788a341cf0ad05604fdb5ae6b8f2e8c4e83c5c (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32646 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/ConstantFold.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp
index 170df73272..32414721a7 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<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);