diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-05-19 21:17:23 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-05-19 21:17:23 +0000 |
| commit | b42712288e1d63b52728d1c631c880e160f507fe (patch) | |
| tree | 15502fc55e49b0610ff73f3cc31e531957e8bea4 | |
| parent | c958c4c22c91d4a02c534b58c6f3906fb52b36c7 (diff) | |
| download | bcm5719-llvm-b42712288e1d63b52728d1c631c880e160f507fe.tar.gz bcm5719-llvm-b42712288e1d63b52728d1c631c880e160f507fe.zip | |
switch to Type::getFPMantissaWidth instead of reinventing it.
llvm-svn: 51275
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 10d3344598d..0c459cf1430 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -420,18 +420,6 @@ static const Type *getPromotedType(const Type *Ty) { return Ty; } -/// GetFPMantissaWidth - Return the width of the mantissa (aka significand) of -/// the specified floating point type in bits. This returns -1 if unknown. -static int GetFPMantissaWidth(const Type *FPType) { - if (FPType == Type::FloatTy) - return 24; - if (FPType == Type::DoubleTy) - return 53; - if (FPType == Type::X86_FP80Ty) - return 64; - return -1; // Unknown/crazy type. -} - /// getBitCastOperand - If the specified operand is a CastInst or a constant /// expression bitcast, return the operand value, otherwise return null. static Value *getBitCastOperand(Value *V) { @@ -5257,7 +5245,7 @@ Instruction *InstCombiner::FoldFCmp_IntToFP_Cst(FCmpInst &I, // Get the width of the mantissa. We don't want to hack on conversions that // might lose information from the integer, e.g. "i64 -> float" - int MantissaWidth = GetFPMantissaWidth(LHSI->getType()); + int MantissaWidth = LHSI->getType()->getFPMantissaWidth(); if (MantissaWidth == -1) return 0; // Unknown. // Check to see that the input is converted from an integer type that is small @@ -8007,7 +7995,7 @@ Instruction *InstCombiner::visitFPToUI(FPToUIInst &FI) { if (UIToFPInst *SrcI = dyn_cast<UIToFPInst>(FI.getOperand(0))) if (SrcI->getOperand(0)->getType() == FI.getType() && (int)FI.getType()->getPrimitiveSizeInBits() < /*extra bit for sign */ - GetFPMantissaWidth(SrcI->getType())) + SrcI->getType()->getFPMantissaWidth()) return ReplaceInstUsesWith(FI, SrcI->getOperand(0)); return commonCastTransforms(FI); @@ -8020,7 +8008,7 @@ Instruction *InstCombiner::visitFPToSI(FPToSIInst &FI) { if (SIToFPInst *SrcI = dyn_cast<SIToFPInst>(FI.getOperand(0))) if (SrcI->getOperand(0)->getType() == FI.getType() && (int)FI.getType()->getPrimitiveSizeInBits() <= - GetFPMantissaWidth(SrcI->getType())) + SrcI->getType()->getFPMantissaWidth()) return ReplaceInstUsesWith(FI, SrcI->getOperand(0)); return commonCastTransforms(FI); |

