[llvm] r285450 - cmake: Enable the lto cache when building with -flto=thin on darwin

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 28 13:48:48 PDT 2016


Author: bogner
Date: Fri Oct 28 15:48:47 2016
New Revision: 285450

URL: http://llvm.org/viewvc/llvm-project?rev=285450&view=rev
Log:
cmake: Enable the lto cache when building with -flto=thin on darwin

Modified:
    llvm/trunk/cmake/modules/HandleLLVMOptions.cmake

Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=285450&r1=285449&r2=285450&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Fri Oct 28 15:48:47 2016
@@ -647,6 +647,11 @@ string(TOUPPER "${LLVM_ENABLE_LTO}" uppe
 if(uppercase_LLVM_ENABLE_LTO STREQUAL "THIN")
   append("-flto=thin" CMAKE_CXX_FLAGS CMAKE_C_FLAGS
                       CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
+  # On darwin, enable the lto cache. This improves initial build time a little
+  # since we re-link a lot of the same objects, and significantly improves
+  # incremental build time.
+  append_if(APPLE "-Wl,-cache_path_lto,${PROJECT_BINARY_DIR}/lto.cache"
+            CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
 elseif(uppercase_LLVM_ENABLE_LTO STREQUAL "FULL")
   append("-flto=full" CMAKE_CXX_FLAGS CMAKE_C_FLAGS
                  CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)




More information about the llvm-commits mailing list