[all-commits] [llvm/llvm-project] f7fff4: [CSSPGO] Allow inlining recursive call for preinliner

WenleiHe via All-commits all-commits at lists.llvm.org
Thu Sep 2 11:24:43 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f7fff46acc86163cadfee481be6acc6b76659fc4
      https://github.com/llvm/llvm-project/commit/f7fff46acc86163cadfee481be6acc6b76659fc4
  Author: Wenlei He <aktoon at gmail.com>
  Date:   2021-09-02 (Thu, 02 Sep 2021)

  Changed paths:
    M llvm/include/llvm/Analysis/InlineCost.h
    M llvm/lib/Analysis/InlineCost.cpp
    M llvm/lib/Transforms/IPO/SampleProfile.cpp

  Log Message:
  -----------
  [CSSPGO] Allow inlining recursive call for preinliner

When preinliner is used for CSSPGO, we try to honor global preinliner decision as much as we can except for uninlinable callees. We rely on InlineCost::Never to prevent us from illegal inlining.

However, it turns out that we use InlineCost::Never for both illeagle inlining and some of the "not-so-beneficial" inlining.

The most common one is recursive inlining, while it can bloat size a lot during CGSCC bottom-up inlining, it's less of a problem when recursive inlining is guided by profile and done in top-down manner.

Ideally it'd be better to have a clear separation between inline legality check vs cost-benefit check, but that requires a bigger change.

This change enables InlineCost computation to allow inlining recursive calls, controlled by InlineParams. In SampleLoader, we now enable recursive inlining for CSSPGO when global preinliner decision is used.

With this change, we saw a few perf improvements on SPEC2017 with CSSPGO and preinliner on: 2% for povray_r, 6% for xalancbmk_s, 3% omnetpp_s, while size is about the same (no noticeable perf change for all other benchmarks)

Differential Revision: https://reviews.llvm.org/D109104




More information about the All-commits mailing list