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

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 18 13:10:20 PDT 2021


phosek created this revision.
phosek added a reviewer: smeenai.
Herald added subscribers: inglorion, mgorny.
phosek requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102718

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1439,8 +1439,8 @@
   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")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102718.346253.patch
Type: text/x-patch
Size: 789 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210518/4fe6b35f/attachment.bin>


More information about the llvm-commits mailing list