[PATCH] D57835: Fix -ftime-report with -x ir

Matt Arsenault via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 4 19:42:24 PDT 2020


arsenm updated this revision to Diff 255095.
arsenm added a comment.

Rebase, add new PM run line


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57835/new/

https://reviews.llvm.org/D57835

Files:
  clang/lib/CodeGen/CodeGenAction.cpp
  clang/lib/Frontend/CompilerInstance.cpp
  clang/test/Frontend/ftime-report-bitcode.ll


Index: clang/test/Frontend/ftime-report-bitcode.ll
===================================================================
--- /dev/null
+++ clang/test/Frontend/ftime-report-bitcode.ll
@@ -0,0 +1,15 @@
+; RUN: %clang_cc1 -triple x86_64-apple-darwin10 -ftime-report -emit-obj -o /dev/null %s 2>&1 | FileCheck %s
+; RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fexperimental-new-pass-manager -ftime-report -emit-obj -o /dev/null %s 2>&1 | FileCheck %s
+
+target triple ="x86_64-apple-darwin10"
+
+; Make sure the backend time reports are produced when compiling an IR
+; input
+
+; CHECK: Pass execution timing report
+; CHECK: LLVM IR Parsing
+; CHECK: Clang front-end time report
+
+define i32 @foo() {
+  ret i32 0
+}
Index: clang/lib/Frontend/CompilerInstance.cpp
===================================================================
--- clang/lib/Frontend/CompilerInstance.cpp
+++ clang/lib/Frontend/CompilerInstance.cpp
@@ -37,6 +37,7 @@
 #include "clang/Serialization/GlobalModuleIndex.h"
 #include "clang/Serialization/InMemoryModuleCache.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/Pass.h"
 #include "llvm/Support/BuryPointer.h"
 #include "llvm/Support/CrashRecoveryContext.h"
 #include "llvm/Support/Errc.h"
@@ -957,8 +958,10 @@
        << " based upon " << BACKEND_PACKAGE_STRING
        << " default target " << llvm::sys::getDefaultTargetTriple() << "\n";
 
-  if (getFrontendOpts().ShowTimers)
+  if (getFrontendOpts().ShowTimers) {
+    llvm::TimePassesIsEnabled = true;
     createFrontendTimer();
+  }
 
   if (getFrontendOpts().ShowStats || !getFrontendOpts().StatsFile.empty())
     llvm::EnableStatistics(false);
Index: clang/lib/CodeGen/CodeGenAction.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenAction.cpp
+++ clang/lib/CodeGen/CodeGenAction.cpp
@@ -172,7 +172,6 @@
                                 CodeGenOpts, C, CoverageInfo)),
           LinkModules(std::move(LinkModules)) {
       FrontendTimesIsEnabled = TimePasses;
-      llvm::TimePassesIsEnabled = TimePasses;
     }
     llvm::Module *getModule() const { return Gen->GetModule(); }
     std::unique_ptr<llvm::Module> takeModule() {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57835.255095.patch
Type: text/x-patch
Size: 2174 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200405/960c400e/attachment-0001.bin>


More information about the cfe-commits mailing list