Skip to content

Commit cb61c94

Browse files
committedDec 14, 2016
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 llvm-svn: 289669
1 parent fe2c2b0 commit cb61c94

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
 

‎llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h

+2
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ class PassManagerBuilder {
149149
std::string PGOInstrGen;
150150
/// Path of the profile data file.
151151
std::string PGOInstrUse;
152+
/// Path of the sample Profile data file.
153+
std::string PGOSampleUse;
152154

153155
private:
154156
/// ExtensionList - This is list of all of the extensions that are registered.

‎llvm/lib/Transforms/IPO/PassManagerBuilder.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,11 @@ void PassManagerBuilder::addFunctionSimplificationPasses(
383383

384384
void PassManagerBuilder::populateModulePassManager(
385385
legacy::PassManagerBase &MPM) {
386+
if (!PGOSampleUse.empty()) {
387+
MPM.add(createPruneEHPass());
388+
MPM.add(createSampleProfileLoaderPass(PGOSampleUse));
389+
}
390+
386391
// Allow forcing function attributes as a debugging and tuning aid.
387392
MPM.add(createForceFunctionAttrsLegacyPass());
388393

0 commit comments

Comments
 (0)
Please sign in to comment.