diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-12-18 04:22:56 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-12-18 04:22:56 +0000 |
commit | db6b6fb91616b74fe90e59787f5de82df5db9886 (patch) | |
tree | b7cd62107e2c28083f6a07e0a55001da3ecce5e9 /llvm/lib/VMCore/ConstantFolding.cpp | |
parent | a4044f35f4782b8a0d8ab1d142d8456460d428c2 (diff) | |
download | bcm5719-llvm-db6b6fb91616b74fe90e59787f5de82df5db9886.tar.gz bcm5719-llvm-db6b6fb91616b74fe90e59787f5de82df5db9886.zip |
Revert last patch. ConstantInt isn't quite ready for signlessness.
llvm-svn: 32650
Diffstat (limited to 'llvm/lib/VMCore/ConstantFolding.cpp')
-rw-r--r-- | llvm/lib/VMCore/ConstantFolding.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/VMCore/ConstantFolding.cpp b/llvm/lib/VMCore/ConstantFolding.cpp index 32414721a7f..170df732723 100644 --- a/llvm/lib/VMCore/ConstantFolding.cpp +++ b/llvm/lib/VMCore/ConstantFolding.cpp @@ -875,14 +875,16 @@ 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, cast<ConstantIntegral>(V)->getZExtValue()); + V = ConstantInt::get(SrcTy->getUnsignedVersion(), + 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, cast<ConstantIntegral>(V)->getSExtValue()); + V = ConstantInt::get(SrcTy->getSignedVersion(), + cast<ConstantIntegral>(V)->getSExtValue()); else if (const ConstantBool *CB = dyn_cast<ConstantBool>(V)) V = ConstantInt::get(Type::SByteTy, CB->getValue() ? -1 : 0); |