Lang Hames 2571b13d17
[ORC] Add WaitingOnGraph record / replay facilities. (#185275)
WaitingOnGraph is critical to the performance of LLVM's JIT (see e.g.
https://github.com/llvm/llvm-project/issues/179611), and these facilities will
make it easier to capture and investigate test cases, and build a performance
regression suite.

WaitingOnGraph::OpRecorder provides an interface for classes that want to
capture the essential WaitingOnGraph operations: simplify-and-emit, and fail.
WaitingOnGraph::simplify and WaitingOnGraph::fail now take an optional
OpRecorder pointer.

WaitingOnGraphOpStreamRecorder (WaitingOnGraphOpReplay.h) is an OpRecorder
implementation that serializes operations to a line-oriented text format on a
raw_ostream. WaitingOnGraphOpReplay provides types and utilities for iterating
over and replaying recorded operations. readWaitingOnGraphOpsFromBuffer returns
an iterator range over the ops in a serialized buffer.

The new ExecutionSession::setWaitingOnGraphOpRecorder method can be used to
install a recorder to capture ops from OL_notifyEmitted and IL_failSymbols.

The llvm-jitlink tool gains two new options:

 - -waiting-on-graph-capture <filename> records all WaitingOnGraph operations
   during a regular llvm-jitlink invocation.

 - -waiting-on-graph-replay <filename> replays the operations from a capture
   file. In this mode other arguments are ignored.
2026-03-10 18:44:55 +11:00
..