[PATCH] D139454: [CMake] Replace clang binary if using clang-bolt target
Amir Ayupov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 26 20:47:53 PST 2023
Amir updated this revision to Diff 492638.
Amir added a comment.
Use generator expression, put clang-bolt temp binary to CMAKE_CURRENT_BINARY_DIR
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139454/new/
https://reviews.llvm.org/D139454
Files:
clang/CMakeLists.txt
clang/cmake/caches/BOLT-PGO.cmake
llvm/docs/AdvancedBuilds.rst
Index: llvm/docs/AdvancedBuilds.rst
===================================================================
--- llvm/docs/AdvancedBuilds.rst
+++ llvm/docs/AdvancedBuilds.rst
@@ -216,7 +216,7 @@
.. code-block:: console
- $ ninja clang++-bolt
+ $ ninja clang-bolt
If you're seeing errors in the build process, try building with a recent
version of Clang/LLVM by setting the CMAKE_C_COMPILER and
@@ -235,12 +235,11 @@
-DBOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LLD=ON \
-DPGO_INSTRUMENT_LTO=Thin
-Then, to build the final optimized binary, build the stage2-clang++-bolt
-target:
+Then, to build the final optimized binary, build the stage2-clang-bolt target:
.. code-block:: console
- $ ninja stage2-clang++-bolt
+ $ ninja stage2-clang-bolt
3-Stage Non-Determinism
=======================
Index: clang/cmake/caches/BOLT-PGO.cmake
===================================================================
--- clang/cmake/caches/BOLT-PGO.cmake
+++ clang/cmake/caches/BOLT-PGO.cmake
@@ -1,10 +1,10 @@
set(LLVM_ENABLE_PROJECTS "bolt;clang;lld" CACHE STRING "")
set(CLANG_BOOTSTRAP_TARGETS
- stage2-clang++-bolt
+ stage2-clang-bolt
CACHE STRING "")
set(BOOTSTRAP_CLANG_BOOTSTRAP_TARGETS
- clang++-bolt
+ clang-bolt
CACHE STRING "")
set(PGO_BUILD_CONFIGURATION ${CMAKE_CURRENT_LIST_DIR}/BOLT.cmake CACHE STRING "")
Index: clang/CMakeLists.txt
===================================================================
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -874,8 +874,6 @@
set(CLANGXX_PATH ${CLANG_PATH}++)
set(CLANG_INSTRUMENTED ${CLANG_PATH}-bolt.inst)
set(CLANGXX_INSTRUMENTED ${CLANGXX_PATH}-bolt.inst)
- set(CLANG_OPTIMIZED ${CLANG_PATH}-bolt)
- set(CLANGXX_OPTIMIZED ${CLANGXX_PATH}-bolt)
# Instrument clang with BOLT
add_custom_target(clang-instrumented
@@ -953,6 +951,7 @@
)
# Optimize original (pre-bolt) Clang using the collected profile
+ set(CLANG_OPTIMIZED ${CMAKE_CURRENT_BINARY_DIR}/clang.bolt)
add_custom_target(clang-bolt
DEPENDS ${CLANG_OPTIMIZED}
)
@@ -963,22 +962,10 @@
-data ${CMAKE_CURRENT_BINARY_DIR}/prof.fdata
-reorder-blocks=ext-tsp -reorder-functions=hfsort+ -split-functions
-split-all-cold -split-eh -dyno-stats -icf=1 -use-gnu-stack
+ COMMAND ${CMAKE_COMMAND} -E rename ${CLANG_OPTIMIZED} $<TARGET_FILE:clang>
COMMENT "Optimizing Clang with BOLT"
VERBATIM
)
-
- # Make a symlink from clang-bolt to clang++-bolt
- add_custom_target(clang++-bolt
- DEPENDS ${CLANGXX_OPTIMIZED}
- )
- add_custom_command(OUTPUT ${CLANGXX_OPTIMIZED}
- DEPENDS clang-bolt
- COMMAND ${CMAKE_COMMAND} -E create_symlink
- ${CLANG_OPTIMIZED}
- ${CLANGXX_OPTIMIZED}
- COMMENT "Creating symlink from BOLT optimized clang to clang++"
- VERBATIM
- )
endif()
if (LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139454.492638.patch
Type: text/x-patch
Size: 2848 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230127/36d61939/attachment-0001.bin>
More information about the cfe-commits
mailing list