[memprof] Store callsite metadata with memprof records.
authorSnehasish Kumar <snehasishk@google.com>
Wed, 2 Mar 2022 22:06:06 +0000 (14:06 -0800)
committerSnehasish Kumar <snehasishk@google.com>
Mon, 21 Mar 2022 20:58:29 +0000 (13:58 -0700)
commit0d362c90d335509c57c0fbd01ae1829e2b9c3765
treedcad94e58a75362d4d9f4d2eea0c49b693031fd6
parent9276fed284f6a8fdbb3f4f56eee03b256e8172e1
[memprof] Store callsite metadata with memprof records.

To ease profile annotation, each of the callsites in a function can be
annotated with profile data - "IR metadata format for MemProf" [1]. This
patch extends the on-disk serialized record format to store the debug
information for allocation callsites incl inline frames. This change is
incompatible with the existing format i.e. indexed profiles must be
regenerated, raw profiles are unaffected.

[1] https://groups.google.com/g/llvm-dev/c/aWHsdMxKAfE/m/WtEmRqyhAgAJ

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D121179
12 files changed:
llvm/include/llvm/ProfileData/InstrProfWriter.h
llvm/include/llvm/ProfileData/MemProf.h
llvm/include/llvm/ProfileData/RawMemProfReader.h
llvm/lib/ProfileData/InstrProfWriter.cpp
llvm/lib/ProfileData/MemProf.cpp
llvm/lib/ProfileData/RawMemProfReader.cpp
llvm/test/tools/llvm-profdata/Inputs/inline.memprofexe [new file with mode: 0755]
llvm/test/tools/llvm-profdata/memprof-basic.test
llvm/test/tools/llvm-profdata/memprof-inline.test
llvm/tools/llvm-profdata/llvm-profdata.cpp
llvm/unittests/ProfileData/InstrProfTest.cpp
llvm/unittests/ProfileData/MemProfTest.cpp