summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData/SampleProf.cpp
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2017-04-13 19:52:10 +0000
committerDehao Chen <dehao@google.com>2017-04-13 19:52:10 +0000
commit2c7ca9b5df41332b32adec1def081f48ab6ec5d7 (patch)
treeffab65ae25229620b93f6f38e7a6cce2bc6666a1 /llvm/lib/ProfileData/SampleProf.cpp
parenta80f2041f78b025f573ab237186397e8834e1d59 (diff)
downloadbcm5719-llvm-2c7ca9b5df41332b32adec1def081f48ab6ec5d7.tar.gz
bcm5719-llvm-2c7ca9b5df41332b32adec1def081f48ab6ec5d7.zip
SamplePGO: convert callsite samples map key from callsite_location to callsite_location+callee_name
Summary: For iterative SamplePGO, an indirect call can be speculatively promoted to multiple direct calls and get inlined. All these promoted direct calls will share the same callsite location (offset+discriminator). With the current implementation, we cannot distinguish between different promotion candidates and its inlined instance. This patch adds callee_name to the key of the callsite sample map. And added helper functions to get all inlined callee samples for a given callsite location. This helps the profile annotator promote correct targets and inline it before annotation, and ensures all indirect call targets to be annotated correctly. Reviewers: davidxl, dnovillo Reviewed By: davidxl Subscribers: andreadb, llvm-commits Differential Revision: https://reviews.llvm.org/D31950 llvm-svn: 300240
Diffstat (limited to 'llvm/lib/ProfileData/SampleProf.cpp')
-rw-r--r--llvm/lib/ProfileData/SampleProf.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/ProfileData/SampleProf.cpp b/llvm/lib/ProfileData/SampleProf.cpp
index 8493acc2d95..eafdd2154b7 100644
--- a/llvm/lib/ProfileData/SampleProf.cpp
+++ b/llvm/lib/ProfileData/SampleProf.cpp
@@ -129,12 +129,14 @@ void FunctionSamples::print(raw_ostream &OS, unsigned Indent) const {
OS.indent(Indent);
if (!CallsiteSamples.empty()) {
OS << "Samples collected in inlined callsites {\n";
- SampleSorter<LineLocation, FunctionSamples> SortedCallsiteSamples(
+ SampleSorter<LineLocation, FunctionSamplesMap> SortedCallsiteSamples(
CallsiteSamples);
for (const auto &CS : SortedCallsiteSamples.get()) {
- OS.indent(Indent + 2);
- OS << CS->first << ": inlined callee: " << CS->second.getName() << ": ";
- CS->second.print(OS, Indent + 4);
+ for (const auto &FS : CS->second) {
+ OS.indent(Indent + 2);
+ OS << CS->first << ": inlined callee: " << FS.second.getName() << ": ";
+ FS.second.print(OS, Indent + 4);
+ }
}
OS << "}\n";
} else {
OpenPOWER on IntegriCloud