[PATCH] D140908: [MemProf] Context disambiguation cloning pass [patch 1/3]

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 3 10:01:08 PST 2023


tejohnson created this revision.
tejohnson added reviewers: snehasish, davidxl.
Herald added subscribers: ormris, arphaman, steven_wu, mgrang, hiraditya.
Herald added a project: All.
tejohnson requested review of this revision.
Herald added a project: LLVM.

Support for building, printing, and displaying CallsiteContextGraph
which represents the MemProf metadata contexts (built from memprof and
callsite metadata or summary). Uses CRTP to support both IR (regular
LTO) and summary (ThinLTO). Includes support for optionally building
the graph in regular and Thin LTO modes, as well as dumping the graph
to text and to dot files.

Follow-on patches will contain the support for cloning on the graph and
in the IR.

The graph represents the call contexts in all memprof metadata on
allocation calls, with nodes for the allocations themselves, as well as
for the calls in each context. The graph is initially built from the
allocation memprof metadata (or summary) MIBs. It is then updated to
match calls with callsite metadata onto the nodes, updating it to
reflect any inlining performed on those calls.

Each MIB (representing an allocation's call context with allocation
behavior) is assigned a unique context id during the graph build. The
edges and nodes in the graph are decorated with the context ids they
carry. This is used to correctly update the graph when cloning is
performed so that we can uniquify the context for a single (possibly
cloned) allocation.

Depends on D140786 <https://reviews.llvm.org/D140786>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140908

Files:
  llvm/include/llvm/ADT/SetOperations.h
  llvm/include/llvm/Analysis/MemoryProfileInfo.h
  llvm/include/llvm/IR/ModuleSummaryIndex.h
  llvm/include/llvm/Transforms/IPO/PGHOContextDisambiguation.h
  llvm/lib/Analysis/MemoryProfileInfo.cpp
  llvm/lib/LTO/LTO.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassBuilderPipelines.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/CMakeLists.txt
  llvm/lib/Transforms/IPO/PGHOContextDisambiguation.cpp
  llvm/test/ThinLTO/X86/pgho-basic.ll
  llvm/test/ThinLTO/X86/pgho-duplicate-context-ids.ll
  llvm/test/ThinLTO/X86/pgho-indirectcall.ll
  llvm/test/ThinLTO/X86/pgho-inlined.ll
  llvm/test/Transforms/PGHOContextDisambiguation/basic.ll
  llvm/test/Transforms/PGHOContextDisambiguation/duplicate-context-ids.ll
  llvm/test/Transforms/PGHOContextDisambiguation/indirectcall.ll
  llvm/test/Transforms/PGHOContextDisambiguation/inlined.ll
  llvm/test/Transforms/PGHOContextDisambiguation/pass-pipeline.ll
  llvm/unittests/Analysis/MemoryProfileInfoTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140908.486018.patch
Type: text/x-patch
Size: 199671 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230103/e0f4b7b5/attachment-0001.bin>


More information about the llvm-commits mailing list