Amir created this revision. Amir added reviewers: bolt, phosek, MaskRay. Herald added subscribers: StephenFan, wenlei. Herald added a project: All. Amir requested review of this revision. Herald added projects: clang, LLVM. Herald added subscribers: llvm-commits, cfe-commits.
Instead of creating an extra clang-bolt binary and clang++-bolt symlink, replace the original clang binary with BOLT-optimized one. This fixes the issue with installing optimized binary as `install-clang` target now copies the new version. Repository: rG LLVM Github Monorepo 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 @@ -963,22 +963,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} ${CLANG_PATH}-${CLANG_VERSION_MAJOR} 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)
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 @@ -963,22 +963,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} ${CLANG_PATH}-${CLANG_VERSION_MAJOR} 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)
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits