[PATCH] D140155: [Clang][OpenMP] Allow host call to nohost function with host variant

Gheorghe-Teodor Bercea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 15 14:06:03 PST 2022


doru1004 added inline comments.


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:2703
+            OMPDeclareTargetDeclAttr::getDeviceType(
+                VariantFD->getMostRecentDecl());
+        if (!DevTy || *DevTy == OMPDeclareTargetDeclAttr::DT_Host)
----------------
ABataev wrote:
> Why the most recent decl?
I believe that would retrieve the full information about the function since that's where the function is defined?


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:2704
+                VariantFD->getMostRecentDecl());
+        if (!DevTy || *DevTy == OMPDeclareTargetDeclAttr::DT_Host)
+          HasHostFunctionVariant = true;
----------------
ABataev wrote:
> Isuppose it must be `DevTy && *DevTy == OMPDeclareTargetDeclAttr::DT_Host`, no?
Correct me if I'm wrong but if there's no device type associated with the function then it is a host function? For the second part of the condition, if there exists a DevTy associated with the function then it has to be DT_Host.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140155/new/

https://reviews.llvm.org/D140155



More information about the cfe-commits mailing list