summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/SampleProfile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Scalar/SampleProfile.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/SampleProfile.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/SampleProfile.cpp b/llvm/lib/Transforms/Scalar/SampleProfile.cpp
index 594a7beb2e3..3480cd49912 100644
--- a/llvm/lib/Transforms/Scalar/SampleProfile.cpp
+++ b/llvm/lib/Transforms/Scalar/SampleProfile.cpp
@@ -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
OpenPOWER on IntegriCloud