diff options
author | Dan Gohman <gohman@apple.com> | 2008-02-29 01:42:52 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-02-29 01:42:52 +0000 |
commit | 37a9ca5bc580e2a8c602a819a0ebdee1d205f1af (patch) | |
tree | 2730b120277d73a7b105f7b1f65a49ae60dc6c77 /lib/VMCore/ConstantFold.cpp | |
parent | c6f9a06238daebd41620ccc795f289c607393f00 (diff) | |
download | external_llvm-37a9ca5bc580e2a8c602a819a0ebdee1d205f1af.zip external_llvm-37a9ca5bc580e2a8c602a819a0ebdee1d205f1af.tar.gz external_llvm-37a9ca5bc580e2a8c602a819a0ebdee1d205f1af.tar.bz2 |
Use the new convertFromAPInt instead of convertFromZeroExtendedInteger.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47744 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r-- | lib/VMCore/ConstantFold.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 451190f..762a24a 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -170,8 +170,6 @@ static Constant *FoldBitCast(Constant *V, const Type *DestTy) { Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V, const Type *DestTy) { - const Type *SrcTy = V->getType(); - if (isa<UndefValue>(V)) { // zext(undef) = 0, because the top bits will be zero. // sext(undef) = 0, because the top bits will all be the same. @@ -257,12 +255,11 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V, if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) { APInt api = CI->getValue(); const uint64_t zero[] = {0, 0}; - uint32_t BitWidth = cast<IntegerType>(SrcTy)->getBitWidth(); APFloat apf = APFloat(APInt(DestTy->getPrimitiveSizeInBits(), 2, zero)); - (void)apf.convertFromZeroExtendedInteger(api.getRawData(), BitWidth, - opc==Instruction::SIToFP, - APFloat::rmNearestTiesToEven); + (void)apf.convertFromAPInt(api, + opc==Instruction::SIToFP, + APFloat::rmNearestTiesToEven); return ConstantFP::get(DestTy, apf); } if (const ConstantVector *CV = dyn_cast<ConstantVector>(V)) { |