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

Dehao Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 13 17:57:05 PST 2016

danielcdh created this revision.
danielcdh added reviewers: dnovillo, tejohnson, davidxl.
danielcdh added a subscriber: cfe-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/CodeGen/BackendUtil.cpp
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -464,10 +464,8 @@
   if (CodeGenOpts.hasProfileIRUse())
     PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath;
-  if (!CodeGenOpts.SampleProfileFile.empty()) {
-    MPM.add(createPruneEHPass());
-    MPM.add(createSampleProfileLoaderPass(CodeGenOpts.SampleProfileFile));
-  }
+  if (!CodeGenOpts.SampleProfileFile.empty())
+    PMBuilder.PGOSampleUse = CodeGenOpts.SampleProfileFile;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27744.81336.patch
Type: text/x-patch
Size: 662 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161214/2e5ef66a/attachment.bin>

More information about the cfe-commits mailing list