[all-commits] [llvm/llvm-project] 6975ab: [Clang] Reimplement time tracing of NewPassManager...

dongjunduo via All-commits all-commits at lists.llvm.org
Sun Sep 11 07:56:43 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6975ab71260c79ddc7a616814678913e67ea417c
      https://github.com/llvm/llvm-project/commit/6975ab71260c79ddc7a616814678913e67ea417c
  Author: Junduo Dong <andj4cn at gmail.com>
  Date:   2022-09-11 (Sun, 11 Sep 2022)

  Changed paths:
    M llvm/include/llvm/IR/PassInstrumentation.h
    M llvm/include/llvm/IR/PassManager.h
    M llvm/include/llvm/Passes/StandardInstrumentations.h
    M llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
    M llvm/lib/Analysis/CGSCCPassManager.cpp
    M llvm/lib/IR/PassManager.cpp
    M llvm/lib/Passes/StandardInstrumentations.cpp
    M llvm/lib/Transforms/Scalar/LoopPassManager.cpp

  Log Message:
  -----------
  [Clang] Reimplement time tracing of NewPassManager by PassInstrumentation framework

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.

Differential Revision: https://reviews.llvm.org/D131960




More information about the All-commits mailing list