[coff] default to multiple parallel ThinLTO jobs
authorBob Haarman <llvm@inglorion.net>
Wed, 12 Apr 2017 18:36:13 +0000 (18:36 +0000)
committerBob Haarman <llvm@inglorion.net>
Wed, 12 Apr 2017 18:36:13 +0000 (18:36 +0000)
Summary:
lld-link allows the number of parallel ThinLTO jobs to be specified
using /opt:lldltojobs=N. If left unspecified, the implementation
conservatively defaults to 1. This leads to very long link times. This
change makes it so that the default is to automatically set the
parallelism, as we do in the ELF linker.

Reviewers: ruiu, hans

Reviewed By: ruiu, hans

Subscribers: pcc, mehdi_amini, Prazek, llvm-commits

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

llvm-svn: 300089

lld/COFF/Config.h
lld/COFF/LTO.cpp

index 72f8249..31534ae 100644 (file)
@@ -115,7 +115,7 @@ struct Configuration {
   unsigned LTOOptLevel = 2;
 
   // Used for /opt:lldltojobs=N
-  unsigned LTOJobs = 1;
+  unsigned LTOJobs = 0;
   // Used for /opt:lldltopartitions=N
   unsigned LTOPartitions = 1;
 
index 298b71f..6883b3b 100644 (file)
@@ -73,7 +73,7 @@ static std::unique_ptr<lto::LTO> createLTO() {
     checkError(Conf.addSaveTemps(std::string(Config->OutputFile) + ".",
                                  /*UseInputModulePath*/ true));
   lto::ThinBackend Backend;
-  if (Config->LTOJobs != -1u)
+  if (Config->LTOJobs != 0)
     Backend = lto::createInProcessThinBackend(Config->LTOJobs);
   return llvm::make_unique<lto::LTO>(std::move(Conf), Backend,
                                      Config->LTOPartitions);