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/Module.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/Module.cpp')
-rw-r--r-- | llvm/lib/IR/Module.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp index b6dd7ab70a8..dbf4035ac7c 100644 --- a/llvm/lib/IR/Module.cpp +++ b/llvm/lib/IR/Module.cpp @@ -531,12 +531,16 @@ void Module::setCodeModel(CodeModel::Model CL) { addModuleFlag(ModFlagBehavior::Error, "Code Model", CL); } -void Module::setProfileSummary(Metadata *M) { - addModuleFlag(ModFlagBehavior::Error, "ProfileSummary", M); +void Module::setProfileSummary(Metadata *M, ProfileSummary::Kind Kind) { + if (Kind == ProfileSummary::PSK_CSInstr) + addModuleFlag(ModFlagBehavior::Error, "CSProfileSummary", M); + else + addModuleFlag(ModFlagBehavior::Error, "ProfileSummary", M); } -Metadata *Module::getProfileSummary() { - return getModuleFlag("ProfileSummary"); +Metadata *Module::getProfileSummary(bool IsCS) { + return (IsCS ? getModuleFlag("CSProfileSummary") + : getModuleFlag("ProfileSummary")); } void Module::setOwnedMemoryBuffer(std::unique_ptr<MemoryBuffer> MB) { |