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

Tom Stellard via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 8 09:35:59 PST 2024


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

>From db643899042aea45da93c1738b523f139f307295 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Fri, 5 Jan 2024 00:58:58 +0000
Subject: [PATCH] [CMake][Release] Add option for enabling LTO to cache file

This option is LLVM_RELEASE_ENABLE_LTO and it's turned on by default.
---
 clang/cmake/caches/Release.cmake | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

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()



More information about the cfe-commits mailing list