Create SampleProfileLoader pass in llvm instead of clang

Summary: We used to create SampleProfileLoader pass in clang. This makes LTO/ThinLTO unable to add this pass in the linker plugin. This patch moves the SampleProfileLoader pass creation from clang to llvm pass manager builder.

Reviewers: tejohnson, davidxl, dnovillo

Subscribers: llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D27743

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289714 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dehao Chen 2016-12-14 21:40:47 +00:00
parent 85e1264a86
commit 932f24fa52
2 changed files with 7 additions and 0 deletions

View File

@ -149,6 +149,8 @@ public:
std::string PGOInstrGen;
/// Path of the profile data file.
std::string PGOInstrUse;
/// Path of the sample Profile data file.
std::string PGOSampleUse;
private:
/// ExtensionList - This is list of all of the extensions that are registered.

View File

@ -383,6 +383,11 @@ void PassManagerBuilder::addFunctionSimplificationPasses(
void PassManagerBuilder::populateModulePassManager(
legacy::PassManagerBase &MPM) {
if (!PGOSampleUse.empty()) {
MPM.add(createPruneEHPass());
MPM.add(createSampleProfileLoaderPass(PGOSampleUse));
}
// Allow forcing function attributes as a debugging and tuning aid.
MPM.add(createForceFunctionAttrsLegacyPass());