Skip to content

[CMake] Preserve clang-prebolt #109351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions clang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down
Loading