[llvm-branch-commits] [llvm] 95bfd08 - [PGO] Allow overriding -vp-counters-per-site

Raul Tambre via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Dec 15 09:07:39 PST 2020


Author: Raul Tambre
Date: 2020-12-15T19:03:27+02:00
New Revision: 95bfd0849f7fb8d0fe2c5d971ed97c219e1ccf72

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

LOG: [PGO] Allow overriding -vp-counters-per-site

In some build configurations more than 1.5 might be required.
Paramaterize so it can be changed by the user.

Reviewed By: yamauchi

Differential Revision: https://reviews.llvm.org/D93281

Added: 
    

Modified: 
    llvm/cmake/modules/HandleLLVMOptions.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index f313492ba978..5d4d692a70ac 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -904,7 +904,8 @@ option(LLVM_ENABLE_IR_PGO "Build LLVM and tools with IR PGO instrumentation (dep
 mark_as_advanced(LLVM_ENABLE_IR_PGO)
 
 set(LLVM_BUILD_INSTRUMENTED OFF CACHE STRING "Build LLVM and tools with PGO instrumentation. May be specified as IR or Frontend")
-mark_as_advanced(LLVM_BUILD_INSTRUMENTED)
+set(LLVM_VP_COUNTERS_PER_SITE "1.5" CACHE STRING "Value profile counters to use per site for IR PGO with Clang")
+mark_as_advanced(LLVM_BUILD_INSTRUMENTED LLVM_VP_COUNTERS_PER_SITE)
 string(TOUPPER "${LLVM_BUILD_INSTRUMENTED}" uppercase_LLVM_BUILD_INSTRUMENTED)
 
 if (LLVM_BUILD_INSTRUMENTED)
@@ -922,7 +923,7 @@ if (LLVM_BUILD_INSTRUMENTED)
     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"
+      append("-Xclang -mllvm -Xclang -vp-counters-per-site=${LLVM_VP_COUNTERS_PER_SITE}"
         CMAKE_CXX_FLAGS
         CMAKE_C_FLAGS)
     endif()


        


More information about the llvm-branch-commits mailing list