[OpenMP][Tools] Fix handling of initial-task-end
authorJoachim Protze <protze@itc.rwth-aachen.de>
Thu, 31 Mar 2022 17:31:18 +0000 (12:31 -0500)
committerChi-Chun, Chen <chichunchen844@gmail.com>
Thu, 31 Mar 2022 17:33:40 +0000 (12:33 -0500)
Latest OpenMP spec says parallel_data is NULL for initial/implicit-task-end.
We nevertheless need to cleanup the ParallelData here, as there is no other
callback for the end of the implicit parallel region. We can use the reference
stored in the TaskData.

Reviewed By: dreachem

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

openmp/tools/archer/ompt-tsan.cpp

index 7e384dd..6bd1175 100644 (file)
@@ -686,10 +686,10 @@ static void ompt_tsan_implicit_task(ompt_scope_endpoint_t endpoint,
 #endif
     assert(Data->RefCount == 1 &&
            "All tasks should have finished at the implicit barrier!");
-    Data->Delete();
     if (type & ompt_task_initial) {
-      ToParallelData(parallel_data)->Delete();
+      Data->Team->Delete();
     }
+    Data->Delete();
     TsanFuncExit();
     break;
   }