diff options
author | Michael Gottesman <mgottesman@apple.com> | 2013-06-26 23:17:31 +0000 |
---|---|---|
committer | Michael Gottesman <mgottesman@apple.com> | 2013-06-26 23:17:31 +0000 |
commit | c3cfe53b661533401017e39d22022656fc7c74c5 (patch) | |
tree | e8819cd95a26cc865b198fe3fcaf7526029920d7 /lib/Transforms/InstCombine | |
parent | 41489dd295d3b2b3df9c13989552c45efc93b912 (diff) | |
download | external_llvm-c3cfe53b661533401017e39d22022656fc7c74c5.zip external_llvm-c3cfe53b661533401017e39d22022656fc7c74c5.tar.gz external_llvm-c3cfe53b661533401017e39d22022656fc7c74c5.tar.bz2 |
In InstCombine{AddSub,MulDivRem} convert APFloat.isFiniteNonZero() && !APFloat.isDenormal => APFloat.isNormal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185037 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineAddSub.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/lib/Transforms/InstCombine/InstCombineAddSub.cpp index 8ba101d..ac7eac9 100644 --- a/lib/Transforms/InstCombine/InstCombineAddSub.cpp +++ b/lib/Transforms/InstCombine/InstCombineAddSub.cpp @@ -488,7 +488,7 @@ Value *FAddCombine::performFactorization(Instruction *I) { createFSub(AddSub0, AddSub1); if (ConstantFP *CFP = dyn_cast<ConstantFP>(NewAddSub)) { const APFloat &F = CFP->getValueAPF(); - if (!F.isFiniteNonZero() || F.isDenormal()) + if (!F.isNormal()) return 0; } diff --git a/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp index 5c984ba..d0d4f41 100644 --- a/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp +++ b/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp @@ -344,7 +344,7 @@ static bool isFMulOrFDivWithConstant(Value *V) { static bool isNormalFp(const ConstantFP *C) { const APFloat &Flt = C->getValueAPF(); - return Flt.isFiniteNonZero() && !Flt.isDenormal(); + return Flt.isNormal(); } /// foldFMulConst() is a helper routine of InstCombiner::visitFMul(). @@ -893,14 +893,14 @@ Instruction *InstCombiner::visitFDiv(BinaryOperator &I) { // Constant *C = ConstantExpr::getFDiv(C1, C2); const APFloat &F = cast<ConstantFP>(C)->getValueAPF(); - if (F.isFiniteNonZero() && !F.isDenormal()) + if (F.isNormal()) Res = BinaryOperator::CreateFMul(X, C); } else if (match(Op0, m_FDiv(m_Value(X), m_ConstantFP(C1)))) { // (X/C1)/C2 => X /(C2*C1) [=> X * 1/(C2*C1) if reciprocal is allowed] // Constant *C = ConstantExpr::getFMul(C1, C2); const APFloat &F = cast<ConstantFP>(C)->getValueAPF(); - if (F.isFiniteNonZero() && !F.isDenormal()) { + if (F.isNormal()) { Res = CvtFDivConstToReciprocal(X, cast<ConstantFP>(C), AllowReciprocal); if (!Res) @@ -941,7 +941,7 @@ Instruction *InstCombiner::visitFDiv(BinaryOperator &I) { if (Fold) { const APFloat &FoldC = cast<ConstantFP>(Fold)->getValueAPF(); - if (FoldC.isFiniteNonZero() && !FoldC.isDenormal()) { + if (FoldC.isNormal()) { Instruction *R = CreateDiv ? BinaryOperator::CreateFDiv(Fold, X) : BinaryOperator::CreateFMul(X, Fold); |