[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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355131 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rong Xu
2019-02-28 19:55:07 +00:00
parent 014b2ad719
commit 5af7fe31f4
17 changed files with 182 additions and 47 deletions
+8 -4
View File
@@ -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) {