OpenMP tasks can be understood as asynchronous function calls where shared variables are passed by reference and firstprivate variables are passed by value. The OpenMP runtime needs to store these arguments from the instantiation/creation to the asynchronous execution. libomp stores these values along with the internal task data structure that is allocated from the internal memory manager.
During task creation, compiler generated code copies the values into the task object. At the beginning of task execution, compiler generated loads these values to the stack. Due to the memory management, the task object will be reused after the task finished execution. The load during task execution is not synchronized by OpenMP semantics with the store during task creation with reused task object. The memory manager provides the synchronization.
The newly added test demonstrates the false positive report with current LLVM.
This patch adds annotation for the new semantics of the task object. The patch depends on two other patches for TSan runtime and OpenMP runtime.
Can adjust the comment style to be consistent with the others?