diff options
| author | Rong Xu <xur@google.com> | 2019-02-28 19:55:07 +0000 |
|---|---|---|
| committer | Rong Xu <xur@google.com> | 2019-02-28 19:55:07 +0000 |
| commit | a6ff69f6ddf9ab3b3ea8f3f57e8b91a24fa9319f (patch) | |
| tree | b24b61755548564cc6d124f5f7e0cc8acc150e68 /llvm/lib/IR/ProfileSummary.cpp | |
| parent | 7fc6ef7dd7433c1947e1a00db0c32d1c68bf385f (diff) | |
| download | bcm5719-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/IR/ProfileSummary.cpp')
| -rw-r--r-- | llvm/lib/IR/ProfileSummary.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/IR/ProfileSummary.cpp b/llvm/lib/IR/ProfileSummary.cpp index d8596924719..11d95ac19be 100644 --- a/llvm/lib/IR/ProfileSummary.cpp +++ b/llvm/lib/IR/ProfileSummary.cpp @@ -21,8 +21,6 @@ using namespace llvm; -const char *ProfileSummary::KindStr[2] = {"InstrProf", "SampleProfile"}; - // Return an MDTuple with two elements. The first element is a string Key and // the second is a uint64_t Value. static Metadata *getKeyValMD(LLVMContext &Context, const char *Key, @@ -68,6 +66,7 @@ Metadata *ProfileSummary::getDetailedSummaryMD(LLVMContext &Context) { // "SampleProfile"). The rest of the elements of the outer MDTuple are specific // to the kind of profile summary as returned by getFormatSpecificMD. Metadata *ProfileSummary::getMD(LLVMContext &Context) { + const char *KindStr[3] = {"InstrProf", "CSInstrProf", "SampleProfile"}; Metadata *Components[] = { getKeyValMD(Context, "ProfileFormat", KindStr[PSK]), getKeyValMD(Context, "TotalCount", getTotalCount()), @@ -153,6 +152,9 @@ ProfileSummary *ProfileSummary::getFromMD(Metadata *MD) { else if (isKeyValuePair(dyn_cast_or_null<MDTuple>(FormatMD), "ProfileFormat", "InstrProf")) SummaryKind = PSK_Instr; + else if (isKeyValuePair(dyn_cast_or_null<MDTuple>(FormatMD), "ProfileFormat", + "CSInstrProf")) + SummaryKind = PSK_CSInstr; else return nullptr; |

