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

Hiroshi Yamauchi via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 11 09:43:05 PST 2020


Author: Hiroshi Yamauchi
Date: 2020-12-11T09:42:53-08:00
New Revision: a5f5612263ca650ae0aa433539278c2d5f567cf8

URL: https://github.com/llvm/llvm-project/commit/a5f5612263ca650ae0aa433539278c2d5f567cf8
DIFF: https://github.com/llvm/llvm-project/commit/a5f5612263ca650ae0aa433539278c2d5f567cf8.diff

LOG: [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

Added: 
    

Modified: 
    llvm/cmake/modules/HandleLLVMOptions.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 78ed1c06ac9d..f313492ba978 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -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


        


More information about the llvm-commits mailing list