r365545 - [OpenMP] Simplify getFloatTypeSemantics

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 9 12:36:22 PDT 2019


Author: maskray
Date: Tue Jul  9 12:36:22 2019
New Revision: 365545

URL: http://llvm.org/viewvc/llvm-project?rev=365545&view=rev
Log:
[OpenMP] Simplify getFloatTypeSemantics

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

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=365545&r1=365544&r2=365545&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Tue Jul  9 12:36:22 2019
@@ -1525,13 +1525,11 @@ const llvm::fltSemantics &ASTContext::ge
   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();
   }




More information about the cfe-commits mailing list