Skip to content

Commit

Permalink
Create SampleProfileLoader pass in llvm instead of clang
Browse files Browse the repository at this point in the history
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

llvm-svn: 289714
  • Loading branch information
danielcdh committed Dec 14, 2016
1 parent 7849eeb commit a99e082
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h
Expand Up @@ -149,6 +149,8 @@ class PassManagerBuilder {
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.
Expand Down
5 changes: 5 additions & 0 deletions llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
Expand Up @@ -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());

Expand Down

0 comments on commit a99e082

Please sign in to comment.