Add function entry counts from sample profiles.

This patch uses the new function profile metadata "function_entry_count"
to annotate entry counts from sample profiles.

In a sampling profile, the total samples collected at the function entry
are an approximation for the number of times that function was invoked.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237265 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Diego Novillo
2015-05-13 17:04:29 +00:00
parent 552cd98683
commit 0e0929ed98
3 changed files with 31 additions and 0 deletions

View File

@@ -580,6 +580,10 @@ void SampleProfileLoader::propagateWeights(Function &F) {
bool Changed = true;
unsigned i = 0;
// Add an entry count to the function using the samples gathered
// at the function entry.
F.setEntryCount(Samples->getHeadSamples());
// Before propagation starts, build, for each block, a list of
// unique predecessors and successors. This is necessary to handle
// identical edges in multiway branches. Since we visit all blocks and all