[llvm] 16206d1 - [OpenMP] Strip NoInline from known OpenMP runtime functions

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 21 18:18:46 PDT 2021


Author: Joseph Huber
Date: 2021-07-21T21:18:26-04:00
New Revision: 16206d17cd9e6b473673204c458e5f20bcc59fb1

URL: https://github.com/llvm/llvm-project/commit/16206d17cd9e6b473673204c458e5f20bcc59fb1
DIFF: https://github.com/llvm/llvm-project/commit/16206d17cd9e6b473673204c458e5f20bcc59fb1.diff

LOG: [OpenMP] Strip NoInline from known OpenMP runtime functions

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.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D106482

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index 85b11e80c2ed..c82fa696dcf2 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -414,6 +414,7 @@ struct OMPInformationCache : public InformationCache {
     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;                                                        \

diff  --git a/llvm/test/Transforms/OpenMP/add_attributes.ll b/llvm/test/Transforms/OpenMP/add_attributes.ll
index d0edeb0b7f5f..f519a5962f24 100644
--- a/llvm/test/Transforms/OpenMP/add_attributes.ll
+++ b/llvm/test/Transforms/OpenMP/add_attributes.ll
@@ -666,10 +666,10 @@ declare i8* @__kmpc_task_reduction_modifier_init(i8*, i32, i32, i32, i8*)
 
 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 @@ attributes #0 = { noinline }
 ; 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 @@ attributes #0 = { noinline }
 ; 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}


        


More information about the llvm-commits mailing list