[PATCH] D96618: [CMake] Don't optimize tests so much under ThinLTO
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 12 10:47:09 PST 2021
aeubanks created this revision.
Herald added subscribers: mstorsjo, inglorion, mgorny.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This drops check-llvm under -DLLVM_ENABLE_LTO=Thin from 13m to 10m20s.
Repository:
rG LLVM Github Monorepo
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.323398.patch
Type: text/x-patch
Size: 1067 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210212/c136248a/attachment.bin>
More information about the llvm-commits
mailing list