[PATCH] D106482: [OpenMP] Strip NoInline from known OpenMP runtime functions

Joseph Huber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 21 12:53:59 PDT 2021


jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, josemonsalve2.
Herald added subscribers: ormris, guansong, hiraditya, yaxunl.
jhuber6 requested review of this revision.
Herald added subscribers: llvm-commits, sstefan1.
Herald added a project: LLVM.

This patch strips the NoInline attribute from known OpenMP runtime functions.
This is done so that we can denote certain runtime functions as NoInline to
ensure their call sites are intact so they can be checked by OpenMPOpt. We
don't wan't this noinline attribute to remain for any functions after OpenMPOpt
has been run however.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106482

Files:
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/test/Transforms/OpenMP/add_attributes.ll


Index: llvm/test/Transforms/OpenMP/add_attributes.ll
===================================================================
--- llvm/test/Transforms/OpenMP/add_attributes.ll
+++ llvm/test/Transforms/OpenMP/add_attributes.ll
@@ -666,10 +666,10 @@
 
 declare void @__kmpc_proxy_task_completed_ooo(i8*)
 
-; Function Attrs: noinline
+; Function Attrs: noinline cold
 declare void @__kmpc_barrier_simple_spmd(%struct.ident_t* nocapture nofree readonly, i32) #0
 
-attributes #0 = { noinline }
+attributes #0 = { noinline cold }
 
 ; CHECK: ; Function Attrs: nounwind
 ; CHECK-NEXT: declare dso_local void @omp_set_num_threads(i32)
@@ -1208,7 +1208,7 @@
 ; CHECK: ; Function Attrs: nounwind
 ; CHECK-NEXT: declare void @__kmpc_proxy_task_completed_ooo(i8*)
 
-; CHECK: ; Function Attrs: convergent noinline nounwind
+; CHECK: ; Function Attrs: cold convergent nounwind
 ; CHECK-NEXT: declare void @__kmpc_barrier_simple_spmd(%struct.ident_t* nocapture nofree readonly, i32)
 
 ; OPTIMISTIC: ; Function Attrs: inaccessiblememonly nofree nosync nounwind willreturn writeonly
@@ -1736,7 +1736,7 @@
 ; OPTIMISTIC: ; Function Attrs: nofree nosync nounwind willreturn
 ; OPTIMISTIC-NEXT: declare void @__kmpc_proxy_task_completed_ooo(i8*)
 
-; OPTIMISTIC: ; Function Attrs: convergent noinline nounwind 
+; OPTIMISTIC: ; Function Attrs: cold convergent nounwind 
 ; OPTIMISTIC-NEXT: declare void @__kmpc_barrier_simple_spmd(%struct.ident_t* nocapture nofree readonly, i32)
 
 !llvm.module.flags = !{!0}
Index: llvm/lib/Transforms/IPO/OpenMPOpt.cpp
===================================================================
--- llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -415,6 +415,7 @@
     RTLFunctions.insert(F);                                                    \
     if (declMatchesRTFTypes(F, OMPBuilder._ReturnType, ArgsTypes)) {           \
       RuntimeFunctionIDMap[F] = _Enum;                                         \
+      F->removeFnAttr(Attribute::NoInline);                                    \
       auto &RFI = RFIs[_Enum];                                                 \
       RFI.Kind = _Enum;                                                        \
       RFI.Name = _Name;                                                        \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106482.360565.patch
Type: text/x-patch
Size: 2280 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210721/9d907ac8/attachment.bin>


More information about the llvm-commits mailing list