[PATCH] D107649: [OpenMP]Fix PR51349: Remove AlwaysInline for if regions.

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 6 08:01:28 PDT 2021


jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, mikerice.
Herald added subscribers: guansong, yaxunl.
jhuber6 requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

After D94315 <https://reviews.llvm.org/D94315> we add the `NoInline` attribute to the outlined function to handle
data environments in the OpenMP if clause. This conflicted with the `AlwaysInline`
attribute added to the outlined function. for better performance in D106799 <https://reviews.llvm.org/D106799>.
The data environments should ideally not require NoInline, but for now this
fixes PR51349.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107649

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp


Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===================================================================
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -2120,11 +2120,12 @@
     OutlinedFnArgs.append(CapturedVars.begin(), CapturedVars.end());
 
     // Ensure we do not inline the function. This is trivially true for the ones
-    // passed to __kmpc_fork_call but the ones calles in serialized regions
+    // passed to __kmpc_fork_call but the ones called in serialized regions
     // could be inlined. This is not a perfect but it is closer to the invariant
     // we want, namely, every data environment starts with a new function.
     // TODO: We should pass the if condition to the runtime function and do the
     //       handling there. Much cleaner code.
+    OutlinedFn->removeFnAttr(llvm::Attribute::AlwaysInline);
     OutlinedFn->addFnAttr(llvm::Attribute::NoInline);
     RT.emitOutlinedFunctionCall(CGF, Loc, OutlinedFn, OutlinedFnArgs);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107649.364798.patch
Type: text/x-patch
Size: 1008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210806/9a4aa03a/attachment.bin>


More information about the cfe-commits mailing list