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 takeModule() { 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/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 +}