[flang-commits] [clang] [flang] [flang][Driver] Preliminary support for -ftime-report (PR #107270)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Thu Sep 5 04:05:05 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.
----------------
tblah wrote:

What is the reason for diverging from clang here?

https://github.com/llvm/llvm-project/pull/107270


More information about the flang-commits mailing list