From b85e79e95ad76dab8b0b1fa1c362b94b084021e5 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 5 Jun 2020 09:04:07 -0700 Subject: [PATCH] Only perform parallel ir generation if -num-threads > 1 Previously if `-num-threads` was passed as 1, this would still use the parallel codepath, but with only a single thread. --- include/swift/AST/SILOptions.h | 4 +--- lib/Frontend/CompilerInvocation.cpp | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/include/swift/AST/SILOptions.h b/include/swift/AST/SILOptions.h index ac41b9e6aac0..36f53e7069e0 100644 --- a/include/swift/AST/SILOptions.h +++ b/include/swift/AST/SILOptions.h @@ -188,9 +188,7 @@ class SILOptions { return OptMode > OptimizationMode::NoOptimization; } - bool hasMultipleIRGenThreads() const { return NumThreads > 1; } - bool shouldPerformIRGenerationInParallel() const { return NumThreads != 0; } - bool hasMultipleIGMs() const { return hasMultipleIRGenThreads(); } + bool shouldPerformIRGenerationInParallel() const { return NumThreads > 1; } }; } // end namespace swift diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 46bdf5c5f0d8..8c549141af06 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -1204,7 +1204,7 @@ static bool ParseTBDGenArgs(TBDGenOptions &Opts, ArgList &Args, CompilerInvocation &Invocation) { using namespace options; - Opts.HasMultipleIGMs = Invocation.getSILOptions().hasMultipleIGMs(); + Opts.HasMultipleIGMs = Invocation.getSILOptions().shouldPerformIRGenerationInParallel(); if (const Arg *A = Args.getLastArg(OPT_module_link_name)) { Opts.ModuleLinkName = A->getValue();