[PATCH] D145516: [Inliner] Avoid excessive inlining through devirtualised calls

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 20 03:58:07 PDT 2023


jmorse updated this revision to Diff 515274.
jmorse added a comment.
Herald added a subscriber: jdoerfert.

Sounds good; how about simply using the multiplier as the addend, see revised patch. I imagine any addend would correlate and grow with the multiplier, and the only thing it needs to do is eventually make the cost positive, as once that occurs the multiplier should be so large that no further inlining is permitted.

The downside is the attribute name being slightly misleading as it's no longer a multiplier. That doesn't especially bother me, but it could be renamed to `function-inline-cost-extra` if needs be ("extra" is vague enough).

Doing this will slightly increase the frequency with which `function-inline-cost-multiplier` causes inlining to be suppressed, as we're effectively making it a larger number (see other inline cost test change). As this facility exists to catch rare and undesirable behaviours, I don't think this is an especially bad thing.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145516/new/

https://reviews.llvm.org/D145516

Files:
  llvm/lib/Analysis/InlineCost.cpp
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/test/Transforms/Inline/devirtualize-7.ll
  llvm/test/Transforms/Inline/inline-cost-attributes.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145516.515274.patch
Type: text/x-patch
Size: 6646 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230420/fe3f0e58/attachment.bin>


More information about the llvm-commits mailing list