[llvm] 832f7af - [CMake] Use -O0 for unittests under full LTO as well

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Tue May 18 13:41:44 PDT 2021


Author: Petr Hosek
Date: 2021-05-18T13:41:32-07:00
New Revision: 832f7af2832ed4c059e2fc2c1b7663b5d0ff9494

URL: https://github.com/llvm/llvm-project/commit/832f7af2832ed4c059e2fc2c1b7663b5d0ff9494
DIFF: https://github.com/llvm/llvm-project/commit/832f7af2832ed4c059e2fc2c1b7663b5d0ff9494.diff

LOG: [CMake] Use -O0 for unittests under full LTO as well

We already use -O0 for unittests under ThinLTO, do the same for full LTO
where the compile time costs to runtime benefits tradeoff is even worse.

Differential Revision: https://reviews.llvm.org/D102718

Added: 
    

Modified: 
    llvm/cmake/modules/AddLLVM.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 1c419cddbe93..f3b27937fd8e 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1439,8 +1439,8 @@ function(add_unittest test_suite test_name)
   list(APPEND LLVM_LINK_COMPONENTS Support) # gtest needs it for raw_ostream
   add_llvm_executable(${test_name} IGNORE_EXTERNALIZE_DEBUGINFO NO_INSTALL_RPATH ${ARGN})
 
-  # The runtime benefits of ThinLTO don't outweight the compile time costs for tests.
-  if(uppercase_LLVM_ENABLE_LTO STREQUAL "THIN")
+  # The runtime benefits of LTO don't outweight the compile time costs for tests.
+  if(LLVM_ENABLE_LTO)
     if((UNIX OR MINGW) AND LLVM_USE_LINKER STREQUAL "lld")
       set_property(TARGET ${test_name} APPEND_STRING PROPERTY
                     LINK_FLAGS " -Wl,--lto-O0")


        


More information about the llvm-commits mailing list