This is an archive of the discontinued LLVM Phabricator instance.

[Inliner] Make the CallPenalty configurable
ClosedPublic

Authored by flip1995 on Jul 14 2021, 6:37 AM.

Details

Summary

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

Diff Detail

Event Timeline

flip1995 created this revision.Jul 14 2021, 6:37 AM
flip1995 published this revision for review.Jul 14 2021, 6:42 AM
flip1995 added reviewers: chandlerc, eastig, aeubanks.
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2021, 6:42 AM
aeubanks edited reviewers, added: mtrofin; removed: chandlerc.Jul 14 2021, 9:00 AM
aeubanks accepted this revision.Jul 14 2021, 9:03 AM

seems reasonable

This revision is now accepted and ready to land.Jul 14 2021, 9:03 AM
mtrofin accepted this revision.Jul 14 2021, 9:38 AM

Is there anything for me to do on the CI failures? I can't reproduce them locally and I can't really tell how they could be caused by this revision, since it doesn't change anything about the default behavior.

xgupta added a subscriber: xgupta.Jul 16 2021, 6:44 AM

You can ignore them.

This revision was landed with ongoing or failed builds.Jul 26 2021, 4:10 AM
This revision was automatically updated to reflect the committed changes.