[PGO] Adjust -vp-counters-per-site under dynamic linking.

Addressing clang bootstrap under the dynamic linking mode running out of static
allocation of value profile nodes, reported in D81682.

Differential Revision: https://reviews.llvm.org/D92669
This commit is contained in:
Hiroshi Yamauchi 2020-12-09 15:04:55 -08:00
parent ba0265a8d8
commit a5f5612263
1 changed files with 9 additions and 0 deletions
llvm/cmake/modules

View File

@ -917,6 +917,15 @@ if (LLVM_BUILD_INSTRUMENTED)
CMAKE_EXE_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS)
endif()
# Set this to avoid running out of the value profile node section
# under clang in dynamic linking mode.
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11 AND
LLVM_LINK_LLVM_DYLIB)
append("-Xclang -mllvm -Xclang -vp-counters-per-site=1.5"
CMAKE_CXX_FLAGS
CMAKE_C_FLAGS)
endif()
elseif(uppercase_LLVM_BUILD_INSTRUMENTED STREQUAL "CSIR")
append("-fcs-profile-generate=\"${LLVM_CSPROFILE_DATA_DIR}\""
CMAKE_CXX_FLAGS