[clang] [CMake][Release] Add option for enabling LTO to cache file (PR #77035)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 4 17:54:04 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Tom Stellard (tstellar)

<details>
<summary>Changes</summary>

This option is LLVM_RELEASE_ENABLE_LTO and it's turned on by default.

---
Full diff: https://github.com/llvm/llvm-project/pull/77035.diff


1 Files Affected:

- (modified) clang/cmake/caches/Release.cmake (+12-1) 


``````````diff
diff --git a/clang/cmake/caches/Release.cmake b/clang/cmake/caches/Release.cmake
index 3ea65ce26296c8..a7b9a8d0e29f88 100644
--- a/clang/cmake/caches/Release.cmake
+++ b/clang/cmake/caches/Release.cmake
@@ -2,6 +2,9 @@
 # BOOTSTRAP_* options configure the second build.
 # BOOTSTRAP_BOOTSTRAP_* options configure the third build.
 
+# General Options
+set(LLVM_RELEASE_ENABLE_LTO THIN CACHE STRING "")
+
 set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
 
 # Stage 1 Bootstrap Setup
@@ -33,9 +36,17 @@ set(BOOTSTRAP_CLANG_BOOTSTRAP_TARGETS
   check-clang CACHE STRING "")
 
 # Stage 2 Options
-set(BOOTSTRAP_LLVM_ENABLE_PROJECTS "clang" CACHE STRING "")
+set(STAGE2_PROJECTS "clang")
+if (LLVM_RELEASE_ENABLE_LTO)
+ list(APPEND STAGE2_PROJECTS "lld")
+endif()
+set(BOOTSTRAP_LLVM_ENABLE_PROJECTS ${STAGE2_PROJECTS} CACHE STRING "")
 set(BOOTSTRAP_LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
 
 # Stage 3 Options
 set(BOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
 set(BOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_PROJECTS "clang;lld;lldb;clang-tools-extra;bolt;polly;mlir;flang" CACHE STRING "")
+set(BOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LTO ${LLVM_RELEASE_ENABLE_LTO} CACHE STRING "")
+if (LLVM_RELEASE_ENABLE_LTO)
+  set(BOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
+endif()

``````````

</details>


https://github.com/llvm/llvm-project/pull/77035


More information about the cfe-commits mailing list