arsenm created this revision. Herald added a subscriber: wdng. This was only printing the clang frontend timer, and none of the backend timers. Set the llvm global for enabling the backend time report when creating the frontend timers, rather than in the BackendConsumer constructor.
There's still something wrong with how the timers are managed though, since the report seems to be printed twice for each one. https://reviews.llvm.org/D57835 Files: lib/CodeGen/CodeGenAction.cpp lib/Frontend/CompilerInstance.cpp test/Frontend/ftime-report-bitcode.ll Index: test/Frontend/ftime-report-bitcode.ll =================================================================== --- /dev/null +++ test/Frontend/ftime-report-bitcode.ll @@ -0,0 +1,14 @@ +; RUN: %clang_cc1 -triple x86_64-apple-darwin10 -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: lib/Frontend/CompilerInstance.cpp =================================================================== --- lib/Frontend/CompilerInstance.cpp +++ lib/Frontend/CompilerInstance.cpp @@ -941,8 +941,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: lib/CodeGen/CodeGenAction.cpp =================================================================== --- lib/CodeGen/CodeGenAction.cpp +++ lib/CodeGen/CodeGenAction.cpp @@ -126,7 +126,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() {
Index: test/Frontend/ftime-report-bitcode.ll =================================================================== --- /dev/null +++ test/Frontend/ftime-report-bitcode.ll @@ -0,0 +1,14 @@ +; RUN: %clang_cc1 -triple x86_64-apple-darwin10 -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: lib/Frontend/CompilerInstance.cpp =================================================================== --- lib/Frontend/CompilerInstance.cpp +++ lib/Frontend/CompilerInstance.cpp @@ -941,8 +941,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: lib/CodeGen/CodeGenAction.cpp =================================================================== --- lib/CodeGen/CodeGenAction.cpp +++ lib/CodeGen/CodeGenAction.cpp @@ -126,7 +126,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() {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits