[all-commits] [llvm/llvm-project] 46c036: [Inliner] Make the CallPenalty configurable

Philipp Krones via All-commits all-commits at lists.llvm.org
Mon Jul 26 04:10:31 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 46c03668774c27877bd96957931fafae24383e3f
      https://github.com/llvm/llvm-project/commit/46c03668774c27877bd96957931fafae24383e3f
  Author: Philipp Krones <philipp.krones at embecosm.com>
  Date:   2021-07-26 (Mon, 26 Jul 2021)

  Changed paths:
    M llvm/include/llvm/Analysis/InlineCost.h
    M llvm/lib/Analysis/InlineCost.cpp
    A llvm/test/Transforms/Inline/inline-call-penalty-option.ll

  Log Message:
  -----------
  [Inliner] Make the CallPenalty configurable

Tests with multiple benchmarks, like Embench [1], showed that the
CallPenalty magic number has the most influence on inlining decisions
when optimizing for size.

On the other hand, there was no good default value for this parameter.
Some benchmarks profited strongly from a reduced call penalty. On
example is the picojpeg benchmark compiled for RISC-V, which got 6%
smaller with a CallPenalty of 10 instead of 12. Other benchmarks
increased in size, like matmult.

This commit makes the compromise of turning the magic number constant of
CallPenalty into a configurable value. This introduces the flag
`--inline-call-penalty`. With that flag users can fine tune the inliner
to their needs.

The CallPenalty constant was also used for loops. This commit replaces
the CallPenalty constant with a new LoopPenalty constant that is now
used instead.

This is a slimmed down version of https://reviews.llvm.org/D30899

[1]: https://github.com/embench/embench-iot

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




More information about the All-commits mailing list