summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ProfileSummaryInfo.cpp
diff options
context:
space:
mode:
authorRong Xu <xur@google.com>2019-02-28 19:55:07 +0000
committerRong Xu <xur@google.com>2019-02-28 19:55:07 +0000
commita6ff69f6ddf9ab3b3ea8f3f57e8b91a24fa9319f (patch)
treeb24b61755548564cc6d124f5f7e0cc8acc150e68 /llvm/lib/Analysis/ProfileSummaryInfo.cpp
parent7fc6ef7dd7433c1947e1a00db0c32d1c68bf385f (diff)
downloadbcm5719-llvm-a6ff69f6ddf9ab3b3ea8f3f57e8b91a24fa9319f.tar.gz
bcm5719-llvm-a6ff69f6ddf9ab3b3ea8f3f57e8b91a24fa9319f.zip
[PGO] Context sensitive PGO (part 2)
Part 2 of CSPGO changes (mostly related to ProfileSummary). Note that I use a default parameter in setProfileSummary() and getSummary(). This is to break the dependency in clang. I will make the parameter explicit after changing clang in a separated patch. Differential Revision: https://reviews.llvm.org/D54175 llvm-svn: 355131
Diffstat (limited to 'llvm/lib/Analysis/ProfileSummaryInfo.cpp')
-rw-r--r--llvm/lib/Analysis/ProfileSummaryInfo.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ProfileSummaryInfo.cpp b/llvm/lib/Analysis/ProfileSummaryInfo.cpp
index bd7817ce67f..1f9e9813c76 100644
--- a/llvm/lib/Analysis/ProfileSummaryInfo.cpp
+++ b/llvm/lib/Analysis/ProfileSummaryInfo.cpp
@@ -79,7 +79,14 @@ static const ProfileSummaryEntry &getEntryForPercentile(SummaryEntryVector &DS,
bool ProfileSummaryInfo::computeSummary() {
if (Summary)
return true;
- auto *SummaryMD = M.getProfileSummary();
+ // First try to get context sensitive ProfileSummary.
+ auto *SummaryMD = M.getProfileSummary(/* IsCS */ true);
+ if (SummaryMD) {
+ Summary.reset(ProfileSummary::getFromMD(SummaryMD));
+ return true;
+ }
+ // This will actually return PSK_Instr or PSK_Sample summary.
+ SummaryMD = M.getProfileSummary(/* IsCS */ false);
if (!SummaryMD)
return false;
Summary.reset(ProfileSummary::getFromMD(SummaryMD));
OpenPOWER on IntegriCloud