blob: f9bdf257d1a4644f2c0b0992a5a989a6ced01b40 [file] [log] [blame]
Joseph Huber6242f9b2021-07-20 16:04:131.. _omp140:
2
Joseph Huber16164072021-07-14 21:04:543Could not internalize function. Some optimizations may not be possible. [OMP140]
4====================================================================================================================
5
Joseph Huber16164072021-07-14 21:04:546This analysis remark indicates that function internalization failed for the
7given function. Internalization occurs when a call to a function that ordinarily
8has external visibility is replaced with a call to a copy of that function with
9only internal visibility. This allows the compiler to make strong static
10assertions about the context a function is called in. Without internalization
11this analysis would always be invalidated by the possibility of someone calling
12the function in a different context outside of the current translation unit.
13This 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
15that cannot be copied. Internalization is currently only enabled by default for
16OpenMP target offloading.
17
18Examples
19--------
20
21This 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 SUN0c660252021-11-15 01:17:0841 omp140.cpp:1:1: remark: Could not internalize function. Some optimizations may not
Joseph Huber16164072021-07-14 21:04:5442 be possible. [OMP140]
43 __attribute__((weak)) void setup() {
44 ^
45
46Diagnostic Scope
47----------------
48
49OpenMP analysis remark.