Move ProfileSummary to IR.

This splits ProfileSummary into two classes: a ProfileSummary class that has methods to convert from/to metadata and a ProfileSummaryBuilder class that computes the profiles summary which is in ProfileData.

Differential Revision: http://reviews.llvm.org/D20314

llvm-svn: 270136
This commit is contained in:
Easwaran Raman
2016-05-19 21:07:12 +00:00
parent b1d37199cc
commit e5a17e3f1d
11 changed files with 309 additions and 246 deletions

View File

@@ -793,10 +793,10 @@ SampleProfileReader::create(std::unique_ptr<MemoryBuffer> &B, LLVMContext &C) {
// For text and GCC file formats, we compute the summary after reading the
// profile. Binary format has the profile summary in its header.
void SampleProfileReader::computeSummary() {
Summary.reset(new SampleProfileSummary(ProfileSummary::DefaultCutoffs));
SampleProfileSummaryBuilder Builder(ProfileSummaryBuilder::DefaultCutoffs);
for (const auto &I : Profiles) {
const FunctionSamples &Profile = I.second;
Summary->addRecord(Profile);
Builder.addRecord(Profile);
}
Summary->computeDetailedSummary();
Summary.reset(Builder.getSummary());
}