[llvm-branch-commits] [clang] [CMake] Preserve clang-prebolt (PR #109351)
Amir Ayupov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Sep 21 20:55:31 PDT 2024
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/109351
>From 9d29e36c4aaafebec930455c1c0a7ac4aa505aea Mon Sep 17 00:00:00 2001
From: Amir Ayupov <aaupov at fb.com>
Date: Fri, 20 Sep 2024 08:04:49 -0700
Subject: [PATCH 1/2] Preserve clang++.prebolt, drop ICF, use cdsort and
cdsplit
Created using spr 1.3.4
---
clang/CMakeLists.txt | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 8e56e41d5572ee..07eeb8a451b58b 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -918,18 +918,19 @@ if (CLANG_BOLT AND NOT LLVM_BUILD_INSTRUMENTED)
# Optimize original (pre-bolt) Clang using the collected profile
set(CLANG_OPTIMIZED ${CMAKE_CURRENT_BINARY_DIR}/clang.bolt)
- set(CLANG_ORIGINAL ${CMAKE_CURRENT_BINARY_DIR}/clang.pre-bolt)
add_custom_target(clang-bolt
DEPENDS ${CLANG_OPTIMIZED}
)
- add_custom_command(OUTPUT ${CLANG_OPTIMIZED} ${CLANG_ORIGINAL}
+ add_custom_command(OUTPUT ${CLANG_OPTIMIZED}
DEPENDS clang-bolt-profile
- COMMAND ${CMAKE_COMMAND} -E copy ${CLANG_PATH} ${CLANG_ORIGINAL}
+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:clang> ${CLANG_PATH}.prebolt
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${CLANG_PATH}.prebolt ${CLANG_PATH}++.prebolt
COMMAND llvm-bolt ${CLANG_PATH}
-o ${CLANG_OPTIMIZED}
-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
${BOLT_NO_LBR}
COMMAND ${CMAKE_COMMAND} -E rename ${CLANG_OPTIMIZED} $<TARGET_FILE:clang>
COMMENT "Optimizing Clang with BOLT"
>From dd3bb7b5363d19c19c49aeb619a40f50bd228be0 Mon Sep 17 00:00:00 2001
From: Amir Ayupov <aaupov at fb.com>
Date: Sat, 21 Sep 2024 20:49:06 -0700
Subject: [PATCH 2/2] Rename to -prebolt instead of copy
Created using spr 1.3.4
---
clang/CMakeLists.txt | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 07eeb8a451b58b..bea1f04ca87430 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -909,6 +909,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)
@@ -917,23 +918,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 ${CMAKE_COMMAND} -E copy $<TARGET_FILE:clang> ${CLANG_PATH}.prebolt
- COMMAND ${CMAKE_COMMAND} -E create_symlink ${CLANG_PATH}.prebolt ${CLANG_PATH}++.prebolt
- 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=cdsort -split-functions
-split-all-cold -split-eh -dyno-stats -use-gnu-stack
- -split-strategy=cdsplit
+ -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 llvm-branch-commits
mailing list