xref: /llvm-project/openmp/docs/remarks/OMP150.rst (revision 0c660256eb41fb0ba44277a32f39d2a028f797f2)
1.. _omp150:
2
3Parallel region merged with parallel region at <location>. [OMP150]
4===================================================================
5
6This optimization remark indicates that a parallel region was merged with others
7into a single parallel region. Parallel region merging fuses consecutive
8parallel regions to reduce the team activation overhead of forking and increases
9the scope of possible OpenMP-specific optimizations within merged parallel
10regions. This optimization can also guard sequential code between two parallel
11regions if applicable.
12
13Example
14-------
15
16This optimization should apply to any compatible and consecutive parallel
17regions. In this case the sequential region between the parallel regions will be
18guarded so it is only executed by a single thread in the new merged region.
19
20.. code-block:: c++
21
22  void foo() {
23  #pragma omp parallel
24    parallel_work();
25
26    sequential_work();
27
28  #pragma omp parallel
29    parallel_work();
30  }
31
32.. code-block:: console
33
34   $ clang++ -fopenmp -O2 -Rpass=openmp-opt -mllvm -openmp-opt-enable-merging omp150.cpp
35   omp150.cpp:2:1: remark: Parallel region merged with parallel region at merge.cpp:7:1. [OMP150]
36   #pragma omp parallel
37   ^
38
39Diagnostic Scope
40----------------
41
42OpenMP optimization remark.
43