[PATCH] D96618: [CMake] Don't optimize tests so much under ThinLTO
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 22 15:14:11 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe765324d89ef: [CMake] Don't optimize tests so much under ThinLTO (authored by aeubanks).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96618/new/
https://reviews.llvm.org/D96618
Files:
llvm/cmake/modules/AddLLVM.cmake
Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1451,6 +1451,18 @@
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")
+ if((UNIX OR MINGW) AND LLVM_USE_LINKER STREQUAL "lld")
+ set_property(TARGET ${test_name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -Wl,--lto-O0")
+ elseif(LINKER_IS_LLD_LINK)
+ set_property(TARGET ${test_name} APPEND_STRING PROPERTY
+ LINK_FLAGS " /opt:lldlto=0")
+ endif()
+ endif()
+
set(outdir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
set_output_directory(${test_name} BINARY_DIR ${outdir} LIBRARY_DIR ${outdir})
# libpthreads overrides some standard library symbols, so main
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96618.325592.patch
Type: text/x-patch
Size: 1067 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210222/690a6a07/attachment.bin>
More information about the llvm-commits
mailing list