[Stats] Flush Stats profiles and tracers at SILModule lifecycle boundary.

This commit is contained in:
Graydon Hoare
2018-05-29 00:21:02 -07:00
parent 044157821e
commit 1c87229104
3 changed files with 19 additions and 0 deletions

View File

@@ -1353,6 +1353,16 @@ static bool performCompileStepsPostSILGen(
runSILLoweringPasses(*SM);
// TODO: at this point we need to flush any the _tracing and profiling_
// in the UnifiedStatsReporter, because the those subsystems of the USR
// retain _pointers into_ the SILModule, and the SILModule's lifecycle is
// not presently such that it will outlive the USR (indeed, as it's
// destroyed on a separate thread, this fact isn't even _deterministic_
// after this point). If future plans require the USR tracing or
// profiling entities after this point, more rearranging will be required.
if (Stats)
Stats->flushTracesAndProfiles();
if (Action == FrontendOptions::ActionType::DumpTypeInfo)
return performDumpTypeInfo(IRGenOpts, *SM, getGlobalLLVMContext());