diff options
author | Dale Johannesen <dalej@apple.com> | 2008-10-09 23:00:39 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2008-10-09 23:00:39 +0000 |
commit | 23a98551ab65eeb8fe5019df8b7db4891582a4bd (patch) | |
tree | 90d6731fd446c04df49383b8a23da0461337ba09 /lib/Transforms | |
parent | 7111b02c734c992b8c97d9918118768026dad79e (diff) |
Add a "loses information" return value to APFloat::convert
and APFloat::convertToInteger. Restore return value to
IEEE754. Adjust all users accordingly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57329 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 8cb5e4fe12..60da031a37 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -7856,8 +7856,10 @@ Instruction *InstCombiner::visitSExt(SExtInst &CI) { /// FitsInFPType - Return a Constant* for the specified FP constant if it fits /// in the specified FP type without changing its value. static Constant *FitsInFPType(ConstantFP *CFP, const fltSemantics &Sem) { + bool losesInfo; APFloat F = CFP->getValueAPF(); - if (F.convert(Sem, APFloat::rmNearestTiesToEven) == APFloat::opOK) + (void)F.convert(Sem, APFloat::rmNearestTiesToEven, &losesInfo); + if (!losesInfo) return ConstantFP::get(F); return 0; } |