diff --git a/clang/utils/perf-training/CMakeLists.txt b/clang/utils/perf-training/CMakeLists.txt --- a/clang/utils/perf-training/CMakeLists.txt +++ b/clang/utils/perf-training/CMakeLists.txt @@ -11,7 +11,7 @@ add_lit_testsuite(generate-profraw "Generating clang PGO data" ${CMAKE_CURRENT_BINARY_DIR}/pgo-data/ EXCLUDE_FROM_CHECK_ALL - DEPENDS clang clear-profraw + DEPENDS clang clear-profraw ${CLANG_PERF_TRAINING_DEPS} ) add_custom_target(clear-profraw diff --git a/llvm/docs/AdvancedBuilds.rst b/llvm/docs/AdvancedBuilds.rst --- a/llvm/docs/AdvancedBuilds.rst +++ b/llvm/docs/AdvancedBuilds.rst @@ -164,6 +164,14 @@ You can feed that file into the LLVM_PROFDATA_FILE option when you build your optimized compiler. +It may be necessary to build additional targets before running perf training, such as +builtins and runtime libraries. You can use the :code:`CLANG_PERF_TRAINING_DEPS` CMake +variable for that purpose: + +.. code-block:: cmake + + set(CLANG_PERF_TRAINING_DEPS builtins runtimes CACHE STRING "") + The PGO cache has a slightly different stage naming scheme than other multi-stage builds. It generates three stages: stage1, stage2-instrumented, and stage2. Both of the stage2 builds are built using the stage1 compiler.