[all-commits] [llvm/llvm-project] 5caad9: [InlineAdvisor] Add fallback/format switches and n...

modiking via All-commits all-commits at lists.llvm.org
Fri Oct 29 12:32:24 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5caad9b5d354ad85d8cbe8ed0e7992db07c29265
      https://github.com/llvm/llvm-project/commit/5caad9b5d354ad85d8cbe8ed0e7992db07c29265
  Author: modimo <modimo at fb.com>
  Date:   2021-10-29 (Fri, 29 Oct 2021)

  Changed paths:
    M llvm/include/llvm/Analysis/InlineAdvisor.h
    M llvm/include/llvm/Analysis/ReplayInlineAdvisor.h
    M llvm/lib/Analysis/InlineAdvisor.cpp
    M llvm/lib/Analysis/ReplayInlineAdvisor.cpp
    M llvm/lib/Transforms/IPO/Inliner.cpp
    M llvm/lib/Transforms/IPO/SampleProfile.cpp
    A llvm/test/Transforms/Inline/Inputs/cgscc-inline-replay-function.txt
    A llvm/test/Transforms/Inline/Inputs/cgscc-inline-replay-line.txt
    M llvm/test/Transforms/Inline/Inputs/cgscc-inline-replay.txt
    M llvm/test/Transforms/Inline/cgscc-inline-replay.ll
    R llvm/test/Transforms/SampleProfile/Inputs/inline-replay-function-scope.txt
    A llvm/test/Transforms/SampleProfile/Inputs/inline-replay-function.txt
    A llvm/test/Transforms/SampleProfile/Inputs/inline-replay-line.txt
    A llvm/test/Transforms/SampleProfile/Inputs/inline-replay-linecolumn.txt
    A llvm/test/Transforms/SampleProfile/Inputs/inline-replay-linediscriminator.txt
    M llvm/test/Transforms/SampleProfile/Inputs/inline-replay.txt
    M llvm/test/Transforms/SampleProfile/inline-replay.ll

  Log Message:
  -----------
  [InlineAdvisor] Add fallback/format switches and negative remark processing to Replay Inliner

Adds the following switches:

1. --sample-profile-inline-replay-fallback/--cgscc-inline-replay-fallback: controls what the replay advisor does for inline sites that are not present in the replay. Options are:

 1. Original: defers to original advisor
 2. AlwaysInline: inline all sites not in replay
 3. NeverInline: inline no sites not in replay

2. --sample-profile-inline-replay-format/--cgscc-inline-replay-format: controls what format should be generated to match against the replay remarks. Options are:

  1. Line
  2. LineColumn
  3. LineDiscriminator
  4. LineColumnDiscriminator

Adds support for negative inlining decisions. These are denoted by "will not be inlined into" as compared to the positive "inlined into" in the remarks.

All of these together with the previous `--sample-profile-inline-replay-scope/--cgscc-inline-replay-scope` allow tweaking in how to apply replay. In my testing, I'm using:
1. --sample-profile-inline-replay-scope/--cgscc-inline-replay-scope = Function to only replay on a function
2. --sample-profile-inline-replay-fallback/--cgscc-inline-replay-fallback = NeverInline since I'm feeding in only positive remarks to the replay system
3. --sample-profile-inline-replay-format/--cgscc-inline-replay-format = Line since I'm generating the remarks from DWARF information from GCC which can conflict quite heavily in column number compared to Clang

An alternative configuration could be to do Function, AlwaysInline, Line fallback with negative remarks which closer matches the final call-sites. Note that this can lead to unbounded inlining if a negative remark doesn't match/exist for one reason or another.

Updated various tests to cover the new switches and negative remarks

Testing:
ninja check-all

Reviewed By: wenlei, mtrofin

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




More information about the All-commits mailing list