Skip to content

Commit 233ce8e

Browse files
pi1024eCodaFi
authored andcommitted
Make numThreads variable unsigned and remove unneeded numThreads parameter
1 parent 30e671a commit 233ce8e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

include/swift/AST/SILOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class SILOptions {
4141
int UnrollThreshold = 250;
4242

4343
/// The number of threads for multi-threaded code generation.
44-
int NumThreads = 0;
44+
unsigned NumThreads = 0;
4545

4646
/// Controls whether to pull in SIL from partial modules during the
4747
/// merge modules step. Could perhaps be merged with the link mode

lib/IRGen/IRGen.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ struct LLVMCodeGenThreads {
11111111
/// All this is done in multiple threads.
11121112
static void performParallelIRGeneration(
11131113
const IRGenOptions &Opts, swift::ModuleDecl *M, std::unique_ptr<SILModule> SILMod,
1114-
StringRef ModuleName, int numThreads,
1114+
StringRef ModuleName,
11151115
ArrayRef<std::string> outputFilenames,
11161116
llvm::StringSet<> *linkerDirectives) {
11171117

@@ -1285,7 +1285,8 @@ static void performParallelIRGeneration(
12851285
llvm::sys::Mutex DiagMutex;
12861286

12871287
// Start all the threads and do the LLVM compilation.
1288-
LLVMCodeGenThreads codeGenThreads(&irgen, &DiagMutex, numThreads - 1);
1288+
1289+
LLVMCodeGenThreads codeGenThreads(&irgen, &DiagMutex, SILMod->getOptions().NumThreads - 1);
12891290
codeGenThreads.startThreads();
12901291

12911292
// Free the memory occupied by the SILModule.
@@ -1319,10 +1320,9 @@ IRGenWholeModuleRequest::evaluate(Evaluator &evaluator,
13191320
auto *M = desc.Ctx.get<ModuleDecl *>();
13201321
if (desc.SILMod->getOptions().shouldPerformIRGenerationInParallel() &&
13211322
!desc.parallelOutputFilenames.empty()) {
1322-
const auto NumThreads = desc.SILMod->getOptions().NumThreads;
13231323
::performParallelIRGeneration(
13241324
desc.Opts, M, std::unique_ptr<SILModule>(desc.SILMod), desc.ModuleName,
1325-
NumThreads, desc.parallelOutputFilenames, desc.LinkerDirectives);
1325+
desc.parallelOutputFilenames, desc.LinkerDirectives);
13261326
// TODO: Parallel LLVM compilation cannot be used if a (single) module is
13271327
// needed as return value.
13281328
return GeneratedModule::null();

0 commit comments

Comments
 (0)