From 6c93ee8d36261e197831f024ce65c26a110369db Mon Sep 17 00:00:00 2001 From: Xinliang David Li Date: Wed, 3 Feb 2016 04:08:18 +0000 Subject: [PGO] Profile summary reader/writer support With this patch, the profile summary data will be available in indexed profile data file so that profiler reader/compiler optimizer can start to make use of. Differential Revision: http://reviews.llvm.org/D16258 llvm-svn: 259626 --- llvm/lib/ProfileData/InstrProf.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'llvm/lib/ProfileData/InstrProf.cpp') diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp index 0ccc16252c2..a06a4370d61 100644 --- a/llvm/lib/ProfileData/InstrProf.cpp +++ b/llvm/lib/ProfileData/InstrProf.cpp @@ -641,4 +641,19 @@ void ProfileSummary::computeDetailedSummary() { } } +ProfileSummary::ProfileSummary(const IndexedInstrProf::Summary &S) + : TotalCount(S.get(IndexedInstrProf::Summary::TotalBlockCount)), + MaxBlockCount(S.get(IndexedInstrProf::Summary::MaxBlockCount)), + MaxInternalBlockCount( + S.get(IndexedInstrProf::Summary::MaxInternalBlockCount)), + MaxFunctionCount(S.get(IndexedInstrProf::Summary::MaxFunctionCount)), + NumBlocks(S.get(IndexedInstrProf::Summary::TotalNumBlocks)), + NumFunctions(S.get(IndexedInstrProf::Summary::TotalNumFunctions)) { + for (unsigned I = 0; I < S.NumCutoffEntries; I++) { + const IndexedInstrProf::Summary::Entry &Ent = S.getEntry(I); + DetailedSummary.emplace_back((uint32_t)Ent.Cutoff, Ent.MinBlockCount, + Ent.NumBlocks); + } +} + } // end namespace llvm -- cgit v1.2.3