Joseph Huber | 6242f9b | 2021-07-20 16:04:13 | [diff] [blame] | 1 | .. _omp140: |
| 2 | |
Joseph Huber | 1616407 | 2021-07-14 21:04:54 | [diff] [blame] | 3 | Could not internalize function. Some optimizations may not be possible. [OMP140] |
| 4 | ==================================================================================================================== |
| 5 | |
Joseph Huber | 1616407 | 2021-07-14 21:04:54 | [diff] [blame] | 6 | This analysis remark indicates that function internalization failed for the |
| 7 | given function. Internalization occurs when a call to a function that ordinarily |
| 8 | has external visibility is replaced with a call to a copy of that function with |
| 9 | only internal visibility. This allows the compiler to make strong static |
| 10 | assertions about the context a function is called in. Without internalization |
| 11 | this analysis would always be invalidated by the possibility of someone calling |
| 12 | the function in a different context outside of the current translation unit. |
| 13 | This is necessary for optimizations like :ref:`OMP111 <omp111>` and :ref:`OMP120 |
| 14 | <omp120>`. If a function failed to be internalized it most likely has linkage |
| 15 | that cannot be copied. Internalization is currently only enabled by default for |
| 16 | OpenMP target offloading. |
| 17 | |
| 18 | Examples |
| 19 | -------- |
| 20 | |
| 21 | This will occur for any function declaration that has incompatible linkage. |
| 22 | |
| 23 | .. code-block:: c++ |
| 24 | |
| 25 | __attribute__((weak)) void setup(); |
| 26 | |
| 27 | void foo() { |
| 28 | #pragma omp target |
| 29 | { |
| 30 | setup(); |
| 31 | #pragma omp parallel |
| 32 | { |
| 33 | work(); |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | .. code-block:: console |
| 39 | |
| 40 | $ clang++ -fopenmp -fopenmp-targets=nvptx64 -O1 -Rpass-analysis=openmp-opt omp140.cpp |
Shao-Ce SUN | 0c66025 | 2021-11-15 01:17:08 | [diff] [blame] | 41 | omp140.cpp:1:1: remark: Could not internalize function. Some optimizations may not |
Joseph Huber | 1616407 | 2021-07-14 21:04:54 | [diff] [blame] | 42 | be possible. [OMP140] |
| 43 | __attribute__((weak)) void setup() { |
| 44 | ^ |
| 45 | |
| 46 | Diagnostic Scope |
| 47 | ---------------- |
| 48 | |
| 49 | OpenMP analysis remark. |