[NFC] Trim trailing whitespace in *.rst
[platform/upstream/llvm.git] / openmp / docs / remarks / OMP150.rst
1 .. _omp150:
2
3 Parallel region merged with parallel region at <location>. [OMP150]
4 ===================================================================
5
6 This optimization remark indicates that a parallel region was merged with others
7 into a single parallel region. Parallel region merging fuses consecutive
8 parallel regions to reduce the team activation overhead of forking and increases
9 the scope of possible OpenMP-specific optimizations within merged parallel
10 regions. This optimization can also guard sequential code between two parallel
11 regions if applicable.
12
13 Example
14 -------
15
16 This optimization should apply to any compatible and consecutive parallel
17 regions. In this case the sequential region between the parallel regions will be
18 guarded 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
39 Diagnostic Scope
40 ----------------
41
42 OpenMP optimization remark.