[PATCH] D26037: Add LoopSink pass for PGO.

Dehao Chen via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 27 09:42:24 PDT 2016


danielcdh created this revision.
danielcdh added reviewers: davidxl, hfinkel.
danielcdh added a subscriber: llvm-commits.
Herald added a subscriber: anna.

PGO has accurate profile info that can be used to enable LoopSink pass


https://reviews.llvm.org/D26037

Files:
  lib/CodeGen/BackendUtil.cpp


Index: lib/CodeGen/BackendUtil.cpp
===================================================================
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -150,6 +150,12 @@
   PM.add(createAddDiscriminatorsPass());
 }
 
+static void addPGOOnlyOptimizations(
+    const PassManagerBuilder &Builder, legacy::PassManagerBase &PM) {
+  PM.add(createLoopSinkPass());
+  PM.add(createInstructionSimplifierPass());
+}
+
 static void addBoundsCheckingPass(const PassManagerBuilder &Builder,
                                   legacy::PassManagerBase &PM) {
   PM.add(createBoundsCheckingPass());
@@ -459,6 +465,10 @@
     MPM.add(createSampleProfileLoaderPass(CodeGenOpts.SampleProfileFile));
   }
 
+  if (!CodeGenOpts.SampleProfileFile.empty() || CodeGenOpts.hasProfileIRUse())
+    PMBuilder.addExtension(PassManagerBuilder::EP_OptimizerLast,
+                           addPGOOnlyOptimizations);
+
   PMBuilder.populateFunctionPassManager(FPM);
   PMBuilder.populateModulePassManager(MPM);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26037.76058.patch
Type: text/x-patch
Size: 1004 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161027/35ea30df/attachment.bin>


More information about the llvm-commits mailing list