diff --git a/llvm/test/Other/time-passes.ll b/llvm/test/Other/time-passes.ll index fd73fe2fd243d..cd5d80ff5923d 100644 --- a/llvm/test/Other/time-passes.ll +++ b/llvm/test/Other/time-passes.ll @@ -14,6 +14,23 @@ ; RUN: rm -f %t; opt < %s -disable-output -passes='default' -time-passes -info-output-file=%t ; RUN: cat %t | FileCheck %s --check-prefix=TIME ; +; TIME: Analysis execution timing report +; TIME: Total Execution Time: +; TIME: Name +; TIME-PER-RUN-DAG: ScalarEvolutionAnalysis +; TIME-PER-RUN-DAG: LoopAnalysis +; TIME-PER-RUN-DAG: DominatorTreeAnalysis +; TIME-PER-RUN-DAG: TargetLibraryAnalysis +; TIME-PER-PASS-DAG: ScalarEvolutionAnalysis +; TIME-PER-PASS-DAG: LoopAnalysis +; TIME-PER-PASS-DAG: DominatorTreeAnalysis +; TIME-PER-PASS-DAG: TargetLibraryAnalysis +; TIME-PER-PASS-NOT: ScalarEvolutionAnalysis # +; TIME-PER-PASS-NOT: LoopAnalysis # +; TIME-PER-PASS-NOT: DominatorTreeAnalysis # +; TIME-PER-PASS-NOT: TargetLibraryAnalysis # +; TIME: Total{{$}} + ; TIME: Pass execution timing report ; TIME: Total Execution Time: ; TIME: Name @@ -46,23 +63,6 @@ ; TIME-PER-PASS-NOT: VerifierPass # ; TIME: Total{{$}} -; TIME: Analysis execution timing report -; TIME: Total Execution Time: -; TIME: Name -; TIME-PER-RUN-DAG: ScalarEvolutionAnalysis -; TIME-PER-RUN-DAG: LoopAnalysis -; TIME-PER-RUN-DAG: DominatorTreeAnalysis -; TIME-PER-RUN-DAG: TargetLibraryAnalysis -; TIME-PER-PASS-DAG: ScalarEvolutionAnalysis -; TIME-PER-PASS-DAG: LoopAnalysis -; TIME-PER-PASS-DAG: DominatorTreeAnalysis -; TIME-PER-PASS-DAG: TargetLibraryAnalysis -; TIME-PER-PASS-NOT: ScalarEvolutionAnalysis # -; TIME-PER-PASS-NOT: LoopAnalysis # -; TIME-PER-PASS-NOT: DominatorTreeAnalysis # -; TIME-PER-PASS-NOT: TargetLibraryAnalysis # -; TIME: Total{{$}} - define i32 @foo() { %res = add i32 5, 4 br label %loop1 diff --git a/llvm/tools/opt/NewPMDriver.cpp b/llvm/tools/opt/NewPMDriver.cpp index 5ed42b054316b..e0a8e1c2a88f2 100644 --- a/llvm/tools/opt/NewPMDriver.cpp +++ b/llvm/tools/opt/NewPMDriver.cpp @@ -14,6 +14,7 @@ #include "NewPMDriver.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringRef.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/CGSCCPassManager.h" @@ -30,6 +31,7 @@ #include "llvm/Passes/PassPlugin.h" #include "llvm/Passes/StandardInstrumentations.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/Timer.h" #include "llvm/Support/ToolOutputFile.h" #include "llvm/Support/VirtualFileSystem.h" #include "llvm/Support/raw_ostream.h" @@ -564,6 +566,9 @@ bool llvm::runPassPipeline( if (DebugifyEach && !DebugifyExport.empty()) exportDebugifyStats(DebugifyExport, Debugify.getDebugifyStatsMap()); + TimerGroup::printAll(*CreateInfoOutputFile()); + TimerGroup::clearAll(); + return true; }