[PATCH] D131960: [Clang] Reimplement time tracing of NewPassManager by PassInstrumentation framework

dongjunduo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 16 05:55:29 PDT 2022


dongjunduo created this revision.
Herald added subscribers: hiraditya, mgorny.
Herald added a project: All.
dongjunduo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The previous implementation of time tracing in NewPassManager is direct but messive.

The key codes are like the demo below:

   /// Runs the function pass across every function in the module.
   PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
                         LazyCallGraph &CG, CGSCCUpdateResult &UR) {
       /// ...
       PreservedAnalyses PassPA;
       {
         TimeTraceScope TimeScope(Pass.name());
         PassPA = Pass.run(F, FAM);
       }
       /// ...
  }

It can be bothered to judge where should we add the tracing codes by hands.

With the PassInstrumentation framework, we can easily add `Before/After` callback
functions to add time tracing codes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131960

Files:
  llvm/include/llvm/IR/PassManager.h
  llvm/include/llvm/IR/PassTimeProfiling.h
  llvm/include/llvm/Passes/StandardInstrumentations.h
  llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
  llvm/lib/Analysis/CGSCCPassManager.cpp
  llvm/lib/IR/CMakeLists.txt
  llvm/lib/IR/PassManager.cpp
  llvm/lib/IR/PassTimeProfiling.cpp
  llvm/lib/Passes/StandardInstrumentations.cpp
  llvm/lib/Transforms/Scalar/LoopPassManager.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131960.452973.patch
Type: text/x-patch
Size: 10188 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220816/2c566a60/attachment.bin>


More information about the llvm-commits mailing list