[PATCH] D109111: [CSSPGO] Use preinliner decision by default when available

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 1 16:31:04 PDT 2021


wenlei created this revision.
wenlei added reviewers: hoy, wmi, wlei.
Herald added subscribers: ormris, modimo, lxfind, hiraditya.
wenlei requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

For CSSPGO, turn on `sample-profile-use-preinliner` by default. This simplifies the use of llvm-profgen preinliner as it's now simply driven by ContextShouldBeInlined flag for each context profile without needing extra compiler switch.

Note that llvm-profgen's preinliner is still off by default, under switch `csspgo-preinliner`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109111

Files:
  llvm/lib/Transforms/IPO/SampleProfile.cpp


Index: llvm/lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -1308,13 +1308,12 @@
   // aiming at better context-sensitive post-inline profile quality, assuming
   // all inline decision estimates are going to be honored by compiler. Here
   // we replay that inline decision under `sample-profile-use-preinliner`.
-  if (UsePreInlinerDecision) {
-    if (Candidate.CalleeSamples->getContext().hasAttribute(
-            ContextShouldBeInlined))
-      return InlineCost::getAlways("preinliner");
-    else
-      return InlineCost::getNever("preinliner");
-  }
+  // Note that we don't need to handle negative decision from preinliner as
+  // context profile for not inlined calls are merged by preinliner already.
+  if (UsePreInlinerDecision &&
+      Candidate.CalleeSamples->getContext().hasAttribute(
+          ContextShouldBeInlined))
+    return InlineCost::getAlways("preinliner");
 
   // For old FDO inliner, we inline the call site as long as cost is not
   // "Never". The cost-benefit check is done earlier.
@@ -1838,6 +1837,10 @@
     if (!CallsitePrioritizedInline.getNumOccurrences())
       CallsitePrioritizedInline = true;
 
+    // For CSSPGO, use preinliner decision by default when available.
+    if (!UsePreInlinerDecision.getNumOccurrences())
+      UsePreInlinerDecision = true;
+
     // Enable iterative-BFI by default for CSSPGO.
     if (!UseIterativeBFIInference.getNumOccurrences())
       UseIterativeBFIInference = true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109111.370109.patch
Type: text/x-patch
Size: 1609 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210901/282ea26d/attachment.bin>


More information about the llvm-commits mailing list