[all-commits] [llvm/llvm-project] 555cf4: [NewPM][PassInstrument] Add PrintPass callback to ...

Yuanfang Chen via All-commits all-commits at lists.llvm.org
Thu Jul 30 10:08:35 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 555cf42f380d86f35e761c3a2179c761356ab152
      https://github.com/llvm/llvm-project/commit/555cf42f380d86f35e761c3a2179c761356ab152
  Author: Yuanfang Chen <yuanfang.chen at sony.com>
  Date:   2020-07-30 (Thu, 30 Jul 2020)

  Changed paths:
    M clang/test/CodeGen/thinlto-distributed-newpm.ll
    M llvm/include/llvm/IR/PassInstrumentation.h
    M llvm/include/llvm/IR/PassManager.h
    M llvm/include/llvm/IR/PassManagerImpl.h
    M llvm/include/llvm/Passes/StandardInstrumentations.h
    M llvm/lib/Analysis/CGSCCPassManager.cpp
    M llvm/lib/IR/PassInstrumentation.cpp
    M llvm/lib/IR/PassTimingInfo.cpp
    M llvm/lib/Passes/StandardInstrumentations.cpp
    M llvm/lib/Transforms/Scalar/LoopPassManager.cpp
    M llvm/test/Other/loop-pm-invalidation.ll
    M llvm/test/Other/new-pass-manager.ll
    M llvm/test/Other/new-pm-defaults.ll
    M llvm/test/Other/new-pm-lto-defaults.ll
    M llvm/test/Other/new-pm-pgo.ll
    M llvm/test/Other/new-pm-thinlto-defaults.ll
    M llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
    M llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
    M llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
    M llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
    M llvm/test/Other/pass-pipeline-parsing.ll
    M llvm/test/Transforms/LoopRotate/pr35210.ll
    M llvm/test/Transforms/LoopUnroll/revisit.ll
    M llvm/test/Transforms/LoopUnroll/unroll-loop-invalidation.ll
    M llvm/test/Transforms/SCCP/ipsccp-preserve-analysis.ll

  Log Message:
  -----------
  [NewPM][PassInstrument] Add PrintPass callback to StandardInstrumentations

Problem:
Right now, our "Running pass" is not accurate when passes are wrapped in adaptor because adaptor is never skipped and a pass could be skipped. The other problem is that "Running pass" for a adaptor is before any "Running pass" of passes/analyses it depends on. (for example, FunctionToLoopPassAdaptor). So the order of printing is not the actual order.

Solution:
Doing things like PassManager::Debuglogging is very intrusive because we need to specify Debuglogging whenever adaptor is created. (Actually, right now we're not specifying Debuglogging for some sub-PassManagers. Check PassBuilder)

This patch move debug logging for pass as a PassInstrument callback. We could be sure that all running passes are logged and in the correct order.

This could also be used to implement hierarchy pass logging in legacy PM. We could also move logging of pass manager to this if we want.

The test fixes looks messy. It includes changes:
- Remove PassInstrumentationAnalysis
- Remove PassAdaptor
- If a PassAdaptor is for a real pass, the pass is added
- Pass reorder (to the correct order), related to PassAdaptor
- Add missing passes (due to Debuglogging not passed down)

Reviewed By: asbirlea, aeubanks

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




More information about the All-commits mailing list