[PATCH] D62067: [Support] Time profiler: support new PassManager

Anton Afanasyev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 17 08:22:31 PDT 2019


anton-afanasyev created this revision.
anton-afanasyev added reviewers: rnk, chandlerc.
Herald added subscribers: llvm-commits, mehdi_amini.
Herald added a project: LLVM.

Add time tracing of backend passes invoked by new PassManager.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62067

Files:
  llvm/include/llvm/IR/PassManager.h


Index: llvm/include/llvm/IR/PassManager.h
===================================================================
--- llvm/include/llvm/IR/PassManager.h
+++ llvm/include/llvm/IR/PassManager.h
@@ -46,6 +46,7 @@
 #include "llvm/IR/PassInstrumentation.h"
 #include "llvm/IR/PassManagerInternal.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/TypeName.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
@@ -512,6 +513,8 @@
       if (!PI.runBeforePass<IRUnitT>(*P, IR))
         continue;
 
+      llvm::TimeTraceScope PassScope("RunPass", P->name());
+
       PreservedAnalyses PassPA = P->run(IR, AM, ExtraArgs...);
 
       // Call onto PassInstrumentation's AfterPass callbacks immediately after
@@ -1290,6 +1293,8 @@
     FunctionAnalysisManager &FAM =
         AM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
 
+    llvm::TimeTraceScope ModuleScope("OptModule", M.getName());
+
     // Request PassInstrumentation from analysis manager, will use it to run
     // instrumenting callbacks for the passes later.
     PassInstrumentation PI = AM.getResult<PassInstrumentationAnalysis>(M);
@@ -1304,6 +1309,9 @@
       // false).
       if (!PI.runBeforePass<Function>(Pass, F))
         continue;
+
+      llvm::TimeTraceScope FunctionScope("OptFunction", F.getName());
+
       PreservedAnalyses PassPA = Pass.run(F, FAM);
 
       PI.runAfterPass(Pass, F);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62067.200049.patch
Type: text/x-patch
Size: 1437 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190517/080d71c8/attachment.bin>


More information about the llvm-commits mailing list