llvm.org GIT mirror llvm / 95da365
limit to 2 parallel links when using thinlto Summary: When using ThinLTO, the linker performs its own parallelism. This change limits the number of parallel link jobs that Ninja will issue to keep the total number of threads reasonable when linking with ThinLTO. Reviewers: hans, ruiu Subscribers: mgorny, mehdi_amini, Prazek Differential Revision: https://reviews.llvm.org/D31990 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301676 91177308-0d34-0410-b5e6-96231b3b80d8 Bob Haarman 2 years ago
1 changed file(s) with 12 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
1515 else()
1616 set(LINKER_IS_LLD_LINK FALSE)
1717 endif()
18
19 set(LLVM_ENABLE_LTO OFF CACHE STRING "Build LLVM with LTO. May be specified as Thin or Full to use a particular kind of LTO")
20 string(TOUPPER "${LLVM_ENABLE_LTO}" uppercase_LLVM_ENABLE_LTO)
1821
1922 # Ninja Job Pool support
2023 # The following only works with the Ninja generator in CMake >= 3.0.
3134
3235 set(LLVM_PARALLEL_LINK_JOBS "" CACHE STRING
3336 "Define the maximum number of concurrent link jobs.")
34 if(LLVM_PARALLEL_LINK_JOBS)
35 if(NOT CMAKE_MAKE_PROGRAM MATCHES "ninja")
36 message(WARNING "Job pooling is only available with Ninja generators.")
37 else()
37 if(CMAKE_MAKE_PROGRAM MATCHES "ninja")
38 if(NOT LLVM_PARALLEL_LINK_JOBS AND uppercase_LLVM_ENABLE_LTO STREQUAL "THIN")
39 message(STATUS "ThinLTO provides its own parallel linking - limiting parallel link jobs to 2.")
40 set(LLVM_PARALLEL_LINK_JOBS "2")
41 endif()
42 if(LLVM_PARALLEL_LINK_JOBS)
3843 set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${LLVM_PARALLEL_LINK_JOBS})
3944 set(CMAKE_JOB_POOL_LINK link_job_pool)
4045 endif()
41 endif()
42
46 elseif(LLVM_PARALLEL_LINK_JOBS)
47 message(WARNING "Job pooling is only available with Ninja generators.")
48 endif()
4349
4450 if (LINKER_IS_LLD_LINK)
4551 # Pass /MANIFEST:NO so that CMake doesn't run mt.exe on our binaries. Adding
723729 CMAKE_EXE_LINKER_FLAGS
724730 CMAKE_SHARED_LINKER_FLAGS)
725731
726 set(LLVM_ENABLE_LTO OFF CACHE STRING "Build LLVM with LTO. May be specified as Thin or Full to use a particular kind of LTO")
727 string(TOUPPER "${LLVM_ENABLE_LTO}" uppercase_LLVM_ENABLE_LTO)
728732 if(LLVM_ENABLE_LTO AND LLVM_ON_WIN32 AND NOT LINKER_IS_LLD_LINK)
729733 message(FATAL_ERROR "When compiling for Windows, LLVM_ENABLE_LTO requires using lld as the linker (point CMAKE_LINKER at lld-link.exe)")
730734 endif()