[PATCH] D44450: [InlineCost] Don't return early when allowSizeGrowth(CS) is false

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 13 16:28:19 PDT 2018


paquette created this revision.
paquette added reviewers: fhahn, efriedma, haicheng, davide.
Herald added subscribers: kristof.beyls, eraman, javed.absar.

In the case that there is only one call of a function with internal linkage, it can still be beneficial to inline functions that are unreachable-terminated (for example, the attached testcase). If we didn't have the check for allowSizeGrowth, this would be inlined as expected.

Since we want to only inline things if they have **at most 0 cost upon the call to allowSizeGrowth**, this commit wraps the tweaks to the threshold in a check for whether or not allowSizeGrowth is true. Thus, we only end up inlining when the cost is 0 or better when allowSizeGrowth(CS) is true.

This produced some minor code size improvements for ARM, AArch64, and x86-64.

Output from compare.py here: https://hastebin.com/fojuquzoru.erl


https://reviews.llvm.org/D44450

Files:
  lib/Analysis/InlineCost.cpp
  test/Transforms/Inline/ARM/unreachable.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44450.138273.patch
Type: text/x-patch
Size: 8386 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180313/8d10396b/attachment-0001.bin>


More information about the llvm-commits mailing list