This is an archive of the discontinued LLVM Phabricator instance.

[NewPM][PassInstrumentation] Add AfterPassSkipped callback
AbandonedPublic

Authored by yrouban on Jul 28 2020, 10:44 PM.

Details

Summary

AfterPassSkipped callback is added to have BeforePass callback correspond to some After* callback:

  • AfterPass - if the pass ran
  • AfterPassInvalidated - if the pass ran but invalidated the IRUnit
  • AfterPassSkipped - if the pass was skipped because some of the BeforePass callbacks returned false.

These complete Before-After braces are needed for maintaining pass-related data structures in instrumentation passes. For example, stack of CFGs before passes in D81558 that checks PreserveCFG: in BeforePass a CFG snapshot is created and pushed to the stack, then in AfterPass it is popped from the stack and compared with current CFG. Even if we do not need to compare CFG we need to push and pop it from the stack.

Diff Detail

Event Timeline

yrouban created this revision.Jul 28 2020, 10:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2020, 10:44 PM
yrouban requested review of this revision.Jul 28 2020, 10:44 PM
ychen added a subscriber: ychen.Jul 28 2020, 10:57 PM
ychen added inline comments.
llvm/include/llvm/IR/PassInstrumentation.h
81

I would prefer BeforeSkippedPassFunc. To be compatible with D84772

yrouban abandoned this revision.Jul 30 2020, 5:02 AM

See D84772.

llvm/include/llvm/IR/PassInstrumentation.h
81

With D84772 landed, this patch is not needed for D81558.
If BeforeNonSkippedPassFuncs is called, then there will be one of After* called.
So, I would vote for D84772 only.