diff options
author | Tim Northover <Tim.Northover@arm.com> | 2013-01-22 09:46:31 +0000 |
---|---|---|
committer | Tim Northover <Tim.Northover@arm.com> | 2013-01-22 09:46:31 +0000 |
commit | 0a29cb045444c13160e90fe7942a9d7c720185ed (patch) | |
tree | a52b128abcdecbe22becedeaa028b36217e450a2 /lib/IR/ConstantFold.cpp | |
parent | dc89ed7da30e882cfdb74968b2a7613e37570409 (diff) | |
download | llvm-0a29cb045444c13160e90fe7942a9d7c720185ed.tar.gz llvm-0a29cb045444c13160e90fe7942a9d7c720185ed.tar.bz2 llvm-0a29cb045444c13160e90fe7942a9d7c720185ed.tar.xz |
Make APFloat constructor require explicit semantics.
Previously we tried to infer it from the bit width size, with an added
IsIEEE argument for the PPC/IEEE 128-bit case, which had a default
value. This default value allowed bugs to creep in, where it was
inappropriate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173138 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/ConstantFold.cpp')
-rw-r--r-- | lib/IR/ConstantFold.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/IR/ConstantFold.cpp b/lib/IR/ConstantFold.cpp index 0ffb24ee63..417e0d14eb 100644 --- a/lib/IR/ConstantFold.cpp +++ b/lib/IR/ConstantFold.cpp @@ -168,8 +168,8 @@ static Constant *FoldBitCast(Constant *V, Type *DestTy) { if (DestTy->isFloatingPointTy()) return ConstantFP::get(DestTy->getContext(), - APFloat(CI->getValue(), - !DestTy->isPPC_FP128Ty())); + APFloat(DestTy->getFltSemantics(), + CI->getValue())); // Otherwise, can't fold this (vector?) return 0; @@ -647,8 +647,8 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V, case Instruction::SIToFP: if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) { APInt api = CI->getValue(); - APFloat apf(APInt::getNullValue(DestTy->getPrimitiveSizeInBits()), - !DestTy->isPPC_FP128Ty() /* isEEEE */); + APFloat apf(DestTy->getFltSemantics(), + APInt::getNullValue(DestTy->getPrimitiveSizeInBits())); (void)apf.convertFromAPInt(api, opc==Instruction::SIToFP, APFloat::rmNearestTiesToEven); |