diff options
author | Teresa Johnson <tejohnson@google.com> | 2016-09-23 20:35:19 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2016-09-23 20:35:19 +0000 |
commit | 468ae9f70366d8ddfa5adfa0c3f3233c678d38f5 (patch) | |
tree | a07b83f72a1a46bf58c8c387f19addcc289572ee /tools/gold | |
parent | 54387416945fec115cde9912be0574544fedf7af (diff) |
[gold] Split plugin options controlling ThinLTO and codegen parallelism.
Summary:
As suggested in D24826, use different options for ThinLTO backend
parallelism from the option controlling regular LTO code gen
parallelism. They are already split in the LTO API, and this enables
controlling them with different clang options.
Reviewers: pcc, mehdi_amini
Subscribers: dexonsmith, llvm-commits, mehdi_amini
Differential Revision: https://reviews.llvm.org/D24873
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282290 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/gold')
-rw-r--r-- | tools/gold/gold-plugin.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index 89a908aec505..34696ba16a97 100644 --- a/tools/gold/gold-plugin.cpp +++ b/tools/gold/gold-plugin.cpp @@ -118,9 +118,11 @@ namespace options { static unsigned OptLevel = 2; // Default parallelism of 0 used to indicate that user did not specify. // Actual parallelism default value depends on implementation. - // Currently, code generation defaults to no parallelism, whereas - // ThinLTO uses the hardware_concurrency as the default. + // Currently only affects ThinLTO, where the default is the + // hardware_concurrency. static unsigned Parallelism = 0; + // Default regular LTO codegen parallelism (number of partitions). + static unsigned ParallelCodeGenParallelismLevel = 1; #ifdef NDEBUG static bool DisableVerify = true; #else @@ -211,6 +213,10 @@ namespace options { } else if (opt.startswith("jobs=")) { if (StringRef(opt_ + 5).getAsInteger(10, Parallelism)) message(LDPL_FATAL, "Invalid parallelism level: %s", opt_ + 5); + } else if (opt.startswith("lto-partitions=")) { + if (opt.substr(strlen("lto-partitions=")) + .getAsInteger(10, ParallelCodeGenParallelismLevel)) + message(LDPL_FATAL, "Invalid codegen partition level: %s", opt_ + 5); } else if (opt == "disable-verify") { DisableVerify = true; } else { @@ -690,7 +696,6 @@ public: static std::unique_ptr<LTO> createLTO() { Config Conf; ThinBackend Backend; - unsigned ParallelCodeGenParallelismLevel = 1; Conf.CPU = options::mcpu; Conf.Options = InitTargetOptionsFromCodeGenFlags(); @@ -704,12 +709,8 @@ static std::unique_ptr<LTO> createLTO() { Conf.CGOptLevel = getCGOptLevel(); Conf.DisableVerify = options::DisableVerify; Conf.OptLevel = options::OptLevel; - if (options::Parallelism) { - if (options::thinlto) - Backend = createInProcessThinBackend(options::Parallelism); - else - ParallelCodeGenParallelismLevel = options::Parallelism; - } + if (options::Parallelism) + Backend = createInProcessThinBackend(options::Parallelism); if (options::thinlto_index_only) { std::string OldPrefix, NewPrefix; getThinLTOOldAndNewPrefix(OldPrefix, NewPrefix); @@ -749,7 +750,7 @@ static std::unique_ptr<LTO> createLTO() { } return llvm::make_unique<LTO>(std::move(Conf), Backend, - ParallelCodeGenParallelismLevel); + options::ParallelCodeGenParallelismLevel); } // Write empty files that may be expected by a distributed build |