Skip to content

Commit d111dca

Browse files
committed
IRGen: fix debugging timers
When enabled, those timers caused a crash when doing multithreaded whole module optimizations.
1 parent d7f4238 commit d111dca

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/IRGen/IRGen.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ void setModuleFlags(IRGenModule &IGM) {
150150

151151
void swift::performLLVMOptimizations(IRGenOptions &Opts, llvm::Module *Module,
152152
llvm::TargetMachine *TargetMachine) {
153-
SharedTimer timer("LLVM optimization");
154-
155153
// Set up a pipeline.
156154
PassManagerBuilderWrapper PMBuilder(Opts);
157155

@@ -467,10 +465,8 @@ bool swift::performLLVM(IRGenOptions &Opts, DiagnosticEngine *Diags,
467465
}
468466
}
469467

470-
{
471-
SharedTimer timer("LLVM output");
472-
EmitPasses.run(*Module);
473-
}
468+
EmitPasses.run(*Module);
469+
474470
if (Stats && RawOS.hasValue()) {
475471
if (DiagMutex)
476472
DiagMutex->lock();
@@ -788,6 +784,8 @@ static std::unique_ptr<llvm::Module> performIRGeneration(IRGenOptions &Opts,
788784
if (outModuleHash) {
789785
*outModuleHash = IGM.ModuleHash;
790786
} else {
787+
SharedTimer timer("LLVM pipeline");
788+
791789
// Since no out module hash was set, we need to performLLVM.
792790
if (performLLVM(Opts, &IGM.Context.Diags, nullptr, IGM.ModuleHash,
793791
IGM.getModule(), IGM.TargetMachine.get(),
@@ -1008,6 +1006,8 @@ static void performParallelIRGeneration(IRGenOptions &Opts,
10081006
// Bail out if there are any errors.
10091007
if (Ctx.hadError()) return;
10101008

1009+
SharedTimer timer("LLVM pipeline");
1010+
10111011
std::vector<std::thread> Threads;
10121012
llvm::sys::Mutex DiagMutex;
10131013

0 commit comments

Comments
 (0)