OSDN Git Service

[PatternMatch] Use ConstantFP::isNan instead of getting the APFloat and calling isNaN...
authorCraig Topper <craig.topper@gmail.com>
Sat, 24 Jun 2017 22:59:11 +0000 (22:59 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sat, 24 Jun 2017 22:59:11 +0000 (22:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306227 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/PatternMatch.h

index 7a3ba10..cd1d80a 100644 (file)
@@ -167,10 +167,8 @@ inline match_combine_or<match_zero, match_neg_zero> m_AnyZero() {
 
 struct match_nan {
   template <typename ITy> bool match(ITy *V) {
-    if (const auto *C = dyn_cast<ConstantFP>(V)) {
-      const APFloat &APF = C->getValueAPF();
-      return APF.isNaN();
-    }
+    if (const auto *C = dyn_cast<ConstantFP>(V))
+      return C->isNaN();
     return false;
   }
 };