[OpenMP] Simplify getFloatTypeSemantics
authorFangrui Song <maskray@google.com>
Tue, 9 Jul 2019 19:36:22 +0000 (19:36 +0000)
committerFangrui Song <maskray@google.com>
Tue, 9 Jul 2019 19:36:22 +0000 (19:36 +0000)
When the float point representations are the same on the host and on the target device,
(`&Target->getLongDoubleFormat() == &AuxTarget->getLongDoubleFormat()`),
we can just use `AuxTarget->getLongDoubleFormat()`.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D64423

llvm-svn: 365545

clang/lib/AST/ASTContext.cpp

index ea13dcb..0d69eb9 100644 (file)
@@ -1525,13 +1525,11 @@ const llvm::fltSemantics &ASTContext::getFloatTypeSemantics(QualType T) const {
   case BuiltinType::Float:      return Target->getFloatFormat();
   case BuiltinType::Double:     return Target->getDoubleFormat();
   case BuiltinType::LongDouble:
-    if (getLangOpts().OpenMP && getLangOpts().OpenMPIsDevice &&
-        &Target->getLongDoubleFormat() != &AuxTarget->getLongDoubleFormat())
+    if (getLangOpts().OpenMP && getLangOpts().OpenMPIsDevice)
       return AuxTarget->getLongDoubleFormat();
     return Target->getLongDoubleFormat();
   case BuiltinType::Float128:
-    if (getLangOpts().OpenMP && getLangOpts().OpenMPIsDevice &&
-        &Target->getFloat128Format() != &AuxTarget->getFloat128Format())
+    if (getLangOpts().OpenMP && getLangOpts().OpenMPIsDevice)
       return AuxTarget->getFloat128Format();
     return Target->getFloat128Format();
   }