[llvm-branch-commits] [openmp] 480cbed - [OpenMP] Remove unnecessary pointer checks in a few locations

Hansang Bae via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jan 22 17:26:03 PST 2021


Author: Hansang Bae
Date: 2021-01-22T19:18:50-06:00
New Revision: 480cbed31e74b0db3d31d78789b639af250ce9fe

URL: https://github.com/llvm/llvm-project/commit/480cbed31e74b0db3d31d78789b639af250ce9fe
DIFF: https://github.com/llvm/llvm-project/commit/480cbed31e74b0db3d31d78789b639af250ce9fe.diff

LOG: [OpenMP] Remove unnecessary pointer checks in a few locations

Also, return NULL from unsuccessful OMPT function lookup.

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

Added: 
    

Modified: 
    openmp/runtime/src/kmp_taskdeps.cpp
    openmp/runtime/src/ompt-general.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/src/kmp_taskdeps.cpp b/openmp/runtime/src/kmp_taskdeps.cpp
index f580431d0182..5713cb9cb4d8 100644
--- a/openmp/runtime/src/kmp_taskdeps.cpp
+++ b/openmp/runtime/src/kmp_taskdeps.cpp
@@ -529,10 +529,9 @@ kmp_int32 __kmpc_omp_task_with_deps(ident_t *loc_ref, kmp_int32 gtid,
       current_task->ompt_task_info.frame.enter_frame.ptr =
           OMPT_GET_FRAME_ADDRESS(0);
     if (ompt_enabled.ompt_callback_task_create) {
-      ompt_data_t task_data = ompt_data_none;
       ompt_callbacks.ompt_callback(ompt_callback_task_create)(
-          current_task ? &(current_task->ompt_task_info.task_data) : &task_data,
-          current_task ? &(current_task->ompt_task_info.frame) : NULL,
+          &(current_task->ompt_task_info.task_data),
+          &(current_task->ompt_task_info.frame),
           &(new_taskdata->ompt_task_info.task_data),
           ompt_task_explicit | TASK_TYPE_DETAILS_FORMAT(new_taskdata), 1,
           OMPT_LOAD_OR_GET_RETURN_ADDRESS(gtid));
@@ -646,13 +645,12 @@ kmp_int32 __kmpc_omp_task_with_deps(ident_t *loc_ref, kmp_int32 gtid,
 void __ompt_taskwait_dep_finish(kmp_taskdata_t *current_task,
                                 ompt_data_t *taskwait_task_data) {
   if (ompt_enabled.ompt_callback_task_schedule) {
-    ompt_data_t task_data = ompt_data_none;
     ompt_callbacks.ompt_callback(ompt_callback_task_schedule)(
-        current_task ? &(current_task->ompt_task_info.task_data) : &task_data,
-        ompt_task_switch, taskwait_task_data);
+        &(current_task->ompt_task_info.task_data), ompt_task_switch,
+        taskwait_task_data);
     ompt_callbacks.ompt_callback(ompt_callback_task_schedule)(
         taskwait_task_data, ompt_task_complete,
-        current_task ? &(current_task->ompt_task_info.task_data) : &task_data);
+        &(current_task->ompt_task_info.task_data));
   }
   current_task->ompt_task_info.frame.enter_frame.ptr = NULL;
   *taskwait_task_data = ompt_data_none;
@@ -698,11 +696,9 @@ void __kmpc_omp_wait_deps(ident_t *loc_ref, kmp_int32 gtid, kmp_int32 ndeps,
       current_task->ompt_task_info.frame.enter_frame.ptr =
           OMPT_GET_FRAME_ADDRESS(0);
     if (ompt_enabled.ompt_callback_task_create) {
-      ompt_data_t task_data = ompt_data_none;
       ompt_callbacks.ompt_callback(ompt_callback_task_create)(
-          current_task ? &(current_task->ompt_task_info.task_data) : &task_data,
-          current_task ? &(current_task->ompt_task_info.frame) : NULL,
-          taskwait_task_data,
+          &(current_task->ompt_task_info.task_data),
+          &(current_task->ompt_task_info.frame), taskwait_task_data,
           ompt_task_explicit | ompt_task_undeferred | ompt_task_mergeable, 1,
           OMPT_LOAD_OR_GET_RETURN_ADDRESS(gtid));
     }

diff  --git a/openmp/runtime/src/ompt-general.cpp b/openmp/runtime/src/ompt-general.cpp
index 36bd6b55f33a..c52a3f28c2e7 100644
--- a/openmp/runtime/src/ompt-general.cpp
+++ b/openmp/runtime/src/ompt-general.cpp
@@ -840,5 +840,5 @@ static ompt_interface_fn_t ompt_fn_lookup(const char *s) {
 
   FOREACH_OMPT_INQUIRY_FN(ompt_interface_fn)
 
-  return (ompt_interface_fn_t)0;
+  return NULL;
 }


        


More information about the llvm-branch-commits mailing list