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 | fdf15e1dc8f1c4cb48a16eb20c536072ca7188fd (patch) | |
tree | ad0799fcb40ec12c340eb063dbf5e75c2d7a3d4a /lib/VMCore/ConstantFold.cpp | |
parent | af58cae8cb9c0ce64ae6a40990a4ad097c71e0e4 (diff) | |
download | llvm-fdf15e1dc8f1c4cb48a16eb20c536072ca7188fd.tar.gz llvm-fdf15e1dc8f1c4cb48a16eb20c536072ca7188fd.tar.bz2 llvm-fdf15e1dc8f1c4cb48a16eb20c536072ca7188fd.tar.xz |
Revert last patch. ConstantInt isn't quite ready for signlessness.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32650 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r-- | lib/VMCore/ConstantFold.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 32414721a7..170df73272 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.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); |