[all-commits] [llvm/llvm-project] 2d6ecf: [InlineAdvisor] New inliner advisor to replay inli...

WenleiHe via All-commits all-commits at lists.llvm.org
Sun Jul 19 08:37:18 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2d6ecfa168c2d36ac88efc854f19b05d1c540ded
      https://github.com/llvm/llvm-project/commit/2d6ecfa168c2d36ac88efc854f19b05d1c540ded
  Author: Wenlei He <aktoon at gmail.com>
  Date:   2020-07-19 (Sun, 19 Jul 2020)

  Changed paths:
    M llvm/include/llvm/Analysis/InlineAdvisor.h
    A llvm/include/llvm/Analysis/ReplayInlineAdvisor.h
    M llvm/lib/Analysis/CMakeLists.txt
    M llvm/lib/Analysis/InlineAdvisor.cpp
    A llvm/lib/Analysis/ReplayInlineAdvisor.cpp
    M llvm/lib/Transforms/IPO/SampleProfile.cpp
    A llvm/test/Transforms/SampleProfile/Inputs/inline-replay.txt
    A llvm/test/Transforms/SampleProfile/inline-replay.ll

  Log Message:
  -----------
  [InlineAdvisor] New inliner advisor to replay inlining from optimization remarks

Summary:
This change added a new inline advisor that takes optimization remarks from previous inlining as input, and provides the decision as advice so current inlining can replay inline decisions of a different compilation. Dwarf inline stack with line and discriminator is used as anchor for call sites including call context. The change can be useful for Inliner tuning as it provides a channel to allow external input for tweaking inline decisions. Existing alternatives like alwaysinline attribute is per-function, not per-callsite. Per-callsite inline intrinsic can be another solution (not yet existing), but it's intrusive to implement and also does not differentiate call context.

A switch -sample-profile-inline-replay=<inline_remarks_file> is added to hook up the new inline advisor with SampleProfileLoader's inline decision for replay. Since SampleProfileLoader does top-down inlining, inline decision can be specialized for each call context, hence we should be able to replay inlining accurately. However with a bottom-up inliner like CGSCC inlining, the replay can be limited due to lack of specialization for different call context. Apart from that limitation, the new inline advisor can still be used by regular CGSCC inliner later if needed for tuning purpose.

Subscribers: mgorny, aprantl, hiraditya, llvm-commits

Tags: #llvm

Resubmit for https://reviews.llvm.org/D84086




More information about the All-commits mailing list