[clang] bbca451 - [CMake] Preserve clang-prebolt
via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 21 20:56:24 PDT 2024
Author: Amir Ayupov
Date: 2024-09-21T20:56:21-07:00
New Revision: bbca451be01fb02d05c2d0586b061fd5611d80ba
URL: https://github.com/llvm/llvm-project/commit/bbca451be01fb02d05c2d0586b061fd5611d80ba
DIFF: https://github.com/llvm/llvm-project/commit/bbca451be01fb02d05c2d0586b061fd5611d80ba.diff
LOG: [CMake] Preserve clang-prebolt
In Clang-BOLT step, preserve pre-BOLT Clang binary (as well as clang++
symlink).
Also modify the default set of BOLT flags:
- drop ICF (can mess with unwinders),
- switch from hfsort+ to cdsort (aliases),
- enable CDSplit,
- update debug sections.
Reviewers: maksfb
Reviewed By: maksfb
Pull Request: https://github.com/llvm/llvm-project/pull/109351
Added:
Modified:
clang/CMakeLists.txt
Removed:
################################################################################
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index c6496167d3828b..94ce5968beb75e 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -899,6 +899,7 @@ if (CLANG_BOLT AND NOT LLVM_BUILD_INSTRUMENTED)
-instrument --instrumentation-file-append-pid
--instrumentation-file=${BOLT_FDATA}
COMMENT "Instrumenting clang binary with BOLT"
+ USES_TERMINAL
VERBATIM
)
add_custom_target(clang-bolt-training-deps DEPENDS clang-instrumented)
@@ -907,20 +908,19 @@ if (CLANG_BOLT AND NOT LLVM_BUILD_INSTRUMENTED)
endif()
# 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}
- )
- add_custom_command(OUTPUT ${CLANG_OPTIMIZED}
DEPENDS clang-bolt-profile
- COMMAND llvm-bolt ${CLANG_PATH}
- -o ${CLANG_OPTIMIZED}
+ COMMAND ${CMAKE_COMMAND} -E rename $<TARGET_FILE:clang> ${CLANG_PATH}-prebolt
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${CLANG_PATH}-prebolt ${CLANG_PATH}++-prebolt
+ COMMAND llvm-bolt ${CLANG_PATH}-prebolt
+ -o $<TARGET_FILE:clang>
-data ${BOLT_FDATA}
- -reorder-blocks=ext-tsp -reorder-functions=hfsort+ -split-functions
- -split-all-cold -split-eh -dyno-stats -icf=1 -use-gnu-stack
+ -reorder-blocks=ext-tsp -reorder-functions=cdsort -split-functions
+ -split-all-cold -split-eh -dyno-stats -use-gnu-stack
+ -split-strategy=cdsplit -update-debug-sections
${BOLT_NO_LBR}
- COMMAND ${CMAKE_COMMAND} -E rename ${CLANG_OPTIMIZED} $<TARGET_FILE:clang>
COMMENT "Optimizing Clang with BOLT"
+ USES_TERMINAL
VERBATIM
)
endif()
More information about the cfe-commits
mailing list