[clang] dabd239 - [CMake] Support injecting extra dependencies for perf-training
Petr Hosek via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 29 22:13:44 PST 2022
Author: Petr Hosek
Date: 2022-11-30T06:13:33Z
New Revision: dabd2391765154848d35f172fbbeb68c88ff9dd4
URL: https://github.com/llvm/llvm-project/commit/dabd2391765154848d35f172fbbeb68c88ff9dd4
DIFF: https://github.com/llvm/llvm-project/commit/dabd2391765154848d35f172fbbeb68c88ff9dd4.diff
LOG: [CMake] Support injecting extra dependencies for perf-training
It may be necessary to build additional targets before running
perf-training, the typical use case would be builtins and runtimes.
This change allows users to specify those dependencies as:
set(CLANG_PERF_TRAINING_DEPS builtins runtimes CACHE STRING "")
Differential Revision: https://reviews.llvm.org/D138974
Added:
Modified:
clang/utils/perf-training/CMakeLists.txt
llvm/docs/AdvancedBuilds.rst
Removed:
################################################################################
diff --git a/clang/utils/perf-training/CMakeLists.txt b/clang/utils/perf-training/CMakeLists.txt
index 57c974072d246..4cd469ddde3ed 100644
--- a/clang/utils/perf-training/CMakeLists.txt
+++ b/clang/utils/perf-training/CMakeLists.txt
@@ -11,7 +11,7 @@ if(LLVM_BUILD_INSTRUMENTED)
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
index 2df0fb009d432..b3e9f85d7fe95 100644
--- a/llvm/docs/AdvancedBuilds.rst
+++ b/llvm/docs/AdvancedBuilds.rst
@@ -164,6 +164,14 @@ should be at a path something like:
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
diff erent 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.
More information about the cfe-commits
mailing list