[PATCH] D84774: [NewPM][PassInstrument] Add PrintPass callback to StandardInstrumentations

Yuanfang Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 28 10:36:27 PDT 2020


ychen created this revision.
ychen added reviewers: asbirlea, aeubanks, hans.
Herald added subscribers: llvm-commits, cfe-commits, dexonsmith, steven_wu, zzheng, hiraditya.
Herald added projects: clang, LLVM.
ychen requested review of this revision.

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 the 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)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84774

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84774.281289.patch
Type: text/x-patch
Size: 102475 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200728/1d517ee0/attachment-0001.bin>


More information about the cfe-commits mailing list