================
@@ -7360,8 +7360,30 @@ ExprResult SemaOpenMP::ActOnOpenMPCall(ExprResult Call,
Scope *Scope,
return Call;
FunctionDecl *CalleeFnDecl = CE->getDirectCallee();
- if (!CalleeFnDecl)
+
+ // Mark indirect calls inside target regions, to allow for insertion of
+ // __llvm_omp_indirect_call_lookup calls during codegen.
+ if (!CalleeFnDecl) {
+ if (isInOpenMPTargetExecutionDirective()) {
+ Expr *E = CE->getCallee()->IgnoreParenImpCasts();
+ DeclRefExpr *DRE = nullptr;
+ while (E) {
+ if ((DRE = dyn_cast<DeclRefExpr>(E)))
+ break;
+ if (auto *ME = dyn_cast<MemberExpr>(E))
+ E = ME->getBase()->IgnoreParenImpCasts();
+ else if (auto *ASE = dyn_cast<ArraySubscriptExpr>(E))
+ E = ASE->getBase()->IgnoreParenImpCasts();
+ else
+ break;
+ }
+ VarDecl *VD = DRE ? dyn_cast<VarDecl>(DRE->getDecl()) : nullptr;
+ if (VD && !VD->hasAttr<OMPTargetIndirectCallAttr>())
+
VD->addAttr(OMPTargetIndirectCallAttr::CreateImplicit(getASTContext()));
----------------
Jason-Van-Beusekom wrote:
Done in
https://github.com/llvm/llvm-project/pull/159857/commits/bb9e61a5b72a44bf38f713f1d836cfa38df9c98b
https://github.com/llvm/llvm-project/pull/159857
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits