[PATCH] D27743: Create SampleProfileLoader pass in llvm instead of clang

Dehao Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 17:56:35 PST 2016

danielcdh created this revision.
danielcdh added reviewers: dnovillo, tejohnson, davidxl.
danielcdh added a subscriber: llvm-commits.
Herald added a subscriber: mehdi_amini.

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.



Index: lib/Transforms/IPO/PassManagerBuilder.cpp
--- lib/Transforms/IPO/PassManagerBuilder.cpp
+++ lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -383,6 +383,11 @@
 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.
Index: include/llvm/Transforms/IPO/PassManagerBuilder.h
--- include/llvm/Transforms/IPO/PassManagerBuilder.h
+++ include/llvm/Transforms/IPO/PassManagerBuilder.h
@@ -149,6 +149,8 @@
   std::string PGOInstrGen;
   /// Path of the profile data file.
   std::string PGOInstrUse;
+  /// Path of the sample Profile data file.
+  std::string PGOSampleUse;
   /// ExtensionList - This is list of all of the extensions that are registered.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27743.81335.patch
Type: text/x-patch
Size: 1090 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161214/2a43ba61/attachment.bin>

More information about the llvm-commits mailing list