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 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 41 omp140.cpp:1:1: remark: Could not internalize function. Some optimizations may not 42 be possible. [OMP140] 43 __attribute__((weak)) void setup() { 44 ^ 45 46Diagnostic Scope 47---------------- 48 49OpenMP analysis remark. 50