aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/ConstantFold.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r--lib/VMCore/ConstantFold.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp
index d4b02d9..106bf5f 100644
--- a/lib/VMCore/ConstantFold.cpp
+++ b/lib/VMCore/ConstantFold.cpp
@@ -198,13 +198,13 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
return 0; // Other pointer types cannot be casted
case Instruction::UIToFP:
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V))
- if (CI->getType()->getBitWidth() <= APInt::APINT_BITS_PER_WORD)
- return ConstantFP::get(DestTy, CI->getValue().roundToDouble(false));
+ if (CI->getType()->getBitWidth() <= 64)
+ return ConstantFP::get(DestTy, CI->getValue().roundToDouble());
return 0;
case Instruction::SIToFP:
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V))
- if (CI->getType()->getBitWidth() <= APInt::APINT_BITS_PER_WORD)
- return ConstantFP::get(DestTy, CI->getValue().roundToDouble(true));
+ if (CI->getType()->getBitWidth() <= 64)
+ return ConstantFP::get(DestTy, CI->getValue().signedRoundToDouble());
return 0;
case Instruction::ZExt:
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {