[SampleFDO] Add FunctionOffsetTable in compact binary format profile.
authorWei Mi <wmi@google.com>
Fri, 14 Sep 2018 20:52:59 +0000 (20:52 +0000)
committerWei Mi <wmi@google.com>
Fri, 14 Sep 2018 20:52:59 +0000 (20:52 +0000)
commit6a14325dffb7a0607e5b3c75d93a837cadad54b4
treeb66e8dff99504155918123b84a96f9577a905c10
parent11511ab5cf306c7c688917bdd69e47dac7292756
[SampleFDO] Add FunctionOffsetTable in compact binary format profile.

The patch saves a function offset table which maps function name index to the
offset of its function profile to the start of the binary profile. By using
the function offset table, for those function profiles which will not be used
when compiling a module, the profile reader does't have to read them. For
profile size around 10~20M, it saves ~10% compile time.

Differential Revision: https://reviews.llvm.org/D51863

llvm-svn: 342283
llvm/include/llvm/ProfileData/SampleProf.h
llvm/include/llvm/ProfileData/SampleProfReader.h
llvm/include/llvm/ProfileData/SampleProfWriter.h
llvm/lib/ProfileData/SampleProf.cpp
llvm/lib/ProfileData/SampleProfReader.cpp
llvm/lib/ProfileData/SampleProfWriter.cpp
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/test/Transforms/SampleProfile/Inputs/function_metadata.compact.afdo
llvm/test/Transforms/SampleProfile/Inputs/indirect-call.compact.afdo
llvm/test/Transforms/SampleProfile/Inputs/inline.compactbinary.afdo
llvm/unittests/ProfileData/SampleProfTest.cpp