Skip to content
Snippets Groups Projects
Commit 4aeaeaf8 authored by Reid Spencer's avatar Reid Spencer
Browse files

Pull out the stops.

llvm-svn: 34703
parent 3370b04a
No related branches found
No related tags found
No related merge requests found
...@@ -198,13 +198,11 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V, ...@@ -198,13 +198,11 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
return 0; // Other pointer types cannot be casted return 0; // Other pointer types cannot be casted
case Instruction::UIToFP: case Instruction::UIToFP:
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) 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; return 0;
case Instruction::SIToFP: case Instruction::SIToFP:
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) 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; return 0;
case Instruction::ZExt: case Instruction::ZExt:
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) { if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment