[llvm-branch-commits] [clang] [CMake] Preserve clang.pre-bolt (PR #109351)

Amir Ayupov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Sep 20 08:04:59 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] 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"



More information about the llvm-branch-commits mailing list