================ @@ -176,6 +205,26 @@ bool CompilerInstance::executeAction(FrontendAction &act) { act.endSourceFile(); } } + + if (timingMgr.isEnabled()) { + timingScopeRoot.stop(); + + // Write the timings to the associated output stream and clear all timers. + // We need to provide another stream because the TimingManager will attempt + // to print in its destructor even if it has been cleared. By the time that + // destructor runs, the output streams will have been destroyed, so give it + // a null stream. + timingMgr.print(); + timingMgr.setOutput( + Fortran::support::createTimingFormatterText(mlir::thread_safe_nulls())); + + // This is deliberately done in "reverse" order and does not match the + // behavior of clang. ---------------- tarunprabhu wrote:
The printing of timings in the case of clang is done when the timer handler's destructors are run. I don't think they are guaranteed to run in a specific order. In this case, we are guaranteeing that the timings will be printed in "reverse", starting from code generation, then LLVM IR optimizations and then the MLIR and parsing. I will edit the comment. https://github.com/llvm/llvm-project/pull/107270 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits