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 | 4f0bd68cfe4f72902215e1c27411286a8bb7d641 (patch) | |
tree | c8880de304064760a3dea7762950f59e7c034cb7 /llvm/lib/Transforms | |
parent | 54306fe499499e57ac1bf8c9cd4fbe8321015ffd (diff) | |
download | bcm5719-llvm-4f0bd68cfe4f72902215e1c27411286a8bb7d641.tar.gz bcm5719-llvm-4f0bd68cfe4f72902215e1c27411286a8bb7d641.zip |
Add a "loses information" return value to APFloat::convert
and APFloat::convertToInteger. Restore return value to
IEEE754. Adjust all users accordingly.
llvm-svn: 57329
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 8cb5e4fe12e..60da031a377 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/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; } |