[PATCH] D26037: Add LoopSink pass for PGO.

Dehao Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 28 09:39:07 PDT 2016


danielcdh updated this revision to Diff 76209.
danielcdh added a comment.

add comment why we need inst simplify


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,13 @@
   PM.add(createAddDiscriminatorsPass());
 }
 
+static void addPGOOnlyOptimizations(
+    const PassManagerBuilder &Builder, legacy::PassManagerBase &PM) {
+  PM.add(createLoopSinkPass());
+  // Get rid of LCSSA nodes.
+  PM.add(createInstructionSimplifierPass());
+}
+
 static void addBoundsCheckingPass(const PassManagerBuilder &Builder,
                                   legacy::PassManagerBase &PM) {
   PM.add(createBoundsCheckingPass());
@@ -459,6 +466,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.76209.patch
Type: text/x-patch
Size: 1034 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161028/ea5fc297/attachment.bin>


More information about the llvm-commits mailing list