Pull out the stops.

llvm-svn: 34703
This commit is contained in:
Reid Spencer 2007-02-27 23:33:03 +00:00
parent 3370b04a66
commit 4aeaeaf894
1 changed files with 2 additions and 4 deletions

View File

@ -198,13 +198,11 @@ 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() <= 64)
return ConstantFP::get(DestTy, CI->getValue().roundToDouble());
return ConstantFP::get(DestTy, CI->getValue().roundToDouble());
return 0;
case Instruction::SIToFP:
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V))
if (CI->getType()->getBitWidth() <= 64)
return ConstantFP::get(DestTy, CI->getValue().signedRoundToDouble());
return ConstantFP::get(DestTy, CI->getValue().signedRoundToDouble());
return 0;
case Instruction::ZExt:
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {