[flang-commits] [clang] [flang] [flang][Driver] Preliminary support for -ftime-report (PR #107270)
Tarun Prabhu via flang-commits
flang-commits at lists.llvm.org
Thu Sep 5 07:45:19 PDT 2024
================
@@ -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
More information about the flang-commits
mailing list