forked from OSchip/llvm-project
Fix dumb regression in constant folding (Regression/C/casts)
llvm-svn: 42165
This commit is contained in:
parent
d1e1645a4e
commit
cc7c475705
|
@ -213,7 +213,7 @@ 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)) {
|
||||
double d = CI->getValue().signedRoundToDouble();
|
||||
double d = CI->getValue().roundToDouble();
|
||||
if (DestTy==Type::FloatTy)
|
||||
return ConstantFP::get(DestTy, APFloat((float)d));
|
||||
else if (DestTy==Type::DoubleTy)
|
||||
|
|
Loading…
Reference in New Issue