[PATCH] D111218: [AMDGPU][OpenMP] Mark oulined functions always_inline

Pushpinder Singh via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 6 04:47:35 PDT 2021


pdhaliwal updated this revision to Diff 377502.
pdhaliwal added a comment.

Only removing optnone.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111218

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===================================================================
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -503,6 +503,11 @@
     F->setDoesNotThrow();
   F->setDoesNotRecurse();
 
+  // TODO: should not need this once amdgcn handles function pointers properly.
+  if (CGM.getTriple().isAMDGCN()) {
+    F->removeFnAttr(llvm::Attribute::OptimizeNone);
+  }
+
   // Generate the function.
   CGF.StartFunction(CD, Ctx.VoidTy, F, FuncInfo, Args, Loc, Loc);
   Address ContextAddr = CGF.GetAddrOfLocalVar(CD->getContextParam());
@@ -665,8 +670,14 @@
   F->setDoesNotRecurse();
 
   // Always inline the outlined function if optimizations are enabled.
-  if (CGM.getCodeGenOpts().OptimizationLevel != 0)
+  if (CGM.getCodeGenOpts().OptimizationLevel != 0) {
     F->addFnAttr(llvm::Attribute::AlwaysInline);
+  }
+
+  // TODO: remove this once amdgcn handles function pointers properly.
+  if (CGM.getTriple().isAMDGCN()) {
+    F->removeFnAttr(llvm::Attribute::OptimizeNone);
+  }
 
   // Generate the function.
   CGF.StartFunction(CD, Ctx.VoidTy, F, FuncInfo, TargetArgs,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111218.377502.patch
Type: text/x-patch
Size: 1155 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211006/e16d5140/attachment.bin>


More information about the cfe-commits mailing list