simplify some code by using the new isNaN predicate
authorChris Lattner <sabre@nondot.org>
Wed, 24 Oct 2007 18:54:45 +0000 (18:54 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 24 Oct 2007 18:54:45 +0000 (18:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43305 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index ef86d2861da812e7b4b7e7e9351af57cc245a54c..56786b8e7bf094e09537100fa0039eac84a477a4 100644 (file)
@@ -3637,8 +3637,7 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
           if (ConstantFP *RHSC = dyn_cast<ConstantFP>(RHS->getOperand(1))) {
             // If either of the constants are nans, then the whole thing returns
             // false.
-            if (LHSC->getValueAPF().getCategory() == APFloat::fcNaN ||
-                RHSC->getValueAPF().getCategory() == APFloat::fcNaN)
+            if (LHSC->getValueAPF().isNaN() || RHSC->getValueAPF().isNaN())
               return ReplaceInstUsesWith(I, ConstantInt::getFalse());
             return new FCmpInst(FCmpInst::FCMP_ORD, LHS->getOperand(0),
                                 RHS->getOperand(0));
@@ -4121,8 +4120,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
           if (ConstantFP *RHSC = dyn_cast<ConstantFP>(RHS->getOperand(1))) {
             // If either of the constants are nans, then the whole thing returns
             // true.
-            if (LHSC->getValueAPF().getCategory() == APFloat::fcNaN ||
-                RHSC->getValueAPF().getCategory() == APFloat::fcNaN)
+            if (LHSC->getValueAPF().isNaN() || RHSC->getValueAPF().isNaN())
               return ReplaceInstUsesWith(I, ConstantInt::getTrue());
             
             // Otherwise, no need to compare the two constants, compare the