[PATCH] D105976: [Inliner] Make the CallPenalty configurable

Philipp Krones via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 14 06:42:24 PDT 2021


flip1995 created this revision.
Herald added subscribers: luismarques, s.egerton, PkmX, simoncook, haicheng, hiraditya, eraman.
flip1995 added reviewers: chandlerc, eastig, aeubanks.
flip1995 published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105976

Files:
  llvm/include/llvm/Analysis/InlineCost.h
  llvm/lib/Analysis/InlineCost.cpp
  llvm/test/Transforms/Inline/inline-call-penalty-option.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105976.358585.patch
Type: text/x-patch
Size: 4040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210714/d3422657/attachment.bin>


More information about the llvm-commits mailing list