50 lines · plain
1.. _omp140:2 3Could not internalize function. Some optimizations may not be possible. [OMP140]4====================================================================================================================5 6This analysis remark indicates that function internalization failed for the7given function. Internalization occurs when a call to a function that ordinarily8has external visibility is replaced with a call to a copy of that function with9only internal visibility. This allows the compiler to make strong static10assertions about the context a function is called in. Without internalization11this analysis would always be invalidated by the possibility of someone calling12the function in a different context outside of the current translation unit.13This is necessary for optimizations like :ref:`OMP111 <omp111>` and :ref:`OMP12014<omp120>`. If a function failed to be internalized it most likely has linkage15that cannot be copied. Internalization is currently only enabled by default for16OpenMP target offloading.17 18Examples19--------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 target29 {30 setup();31 #pragma omp parallel32 {33 work();34 }35 }36 }37 38.. code-block:: console39 40 $ clang++ -fopenmp -fopenmp-targets=nvptx64 -O1 -Rpass-analysis=openmp-opt omp140.cpp41 omp140.cpp:1:1: remark: Could not internalize function. Some optimizations may not42 be possible. [OMP140]43 __attribute__((weak)) void setup() {44 ^45 46Diagnostic Scope47----------------48 49OpenMP analysis remark.50