[SampleFDO] Add the support to split the function profiles with context into
authorWei Mi <wmi@google.com>
Wed, 6 Jan 2021 07:24:43 +0000 (23:24 -0800)
committerWei Mi <wmi@google.com>
Tue, 19 Jan 2021 23:16:19 +0000 (15:16 -0800)
commit21b1ad0340a7ba69c605ea1c218adb567b5190ae
tree054a9bd7c8a95007c30813d82df2f73aa03b4c97
parent1bf2b1665b43e1a5090177486c8fa6374a4596a2
[SampleFDO] Add the support to split the function profiles with context into
separate sections.

For ThinLTO, all the function profiles without context has been annotated to
outline functions if possible in prelink phase. In postlink phase, profile
annotation in postlink phase is only meaningful for function profile with
context. If the profile is large, it is better to split the profile into two
parts, one with context and one without, so the profile reading in postlink
phase only has to read the part with context. To have the profile splitting,
we extend the ExtBinary format to support different section arrangement. It
will be flexible to add other section layout in the future without the need
to create new class inheriting from ExtBinary class.

Differential Revision: https://reviews.llvm.org/D94435
llvm/include/llvm/ProfileData/SampleProf.h
llvm/include/llvm/ProfileData/SampleProfReader.h
llvm/include/llvm/ProfileData/SampleProfWriter.h
llvm/lib/ProfileData/SampleProfReader.cpp
llvm/lib/ProfileData/SampleProfWriter.cpp
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/test/Transforms/SampleProfile/Inputs/ctxsplit.extbinary.afdo [new file with mode: 0644]
llvm/test/Transforms/SampleProfile/ctxsplit.ll [new file with mode: 0644]