[PATCH] D52716: [Inliner] Penalise inlining of calls with loops at Oz

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 1 04:01:45 PDT 2018


dmgreen created this revision.
dmgreen added reviewers: efriedma, chandlerc, fhahn, zzheng, eraman.
Herald added a reviewer: javed.absar.
Herald added a subscriber: haicheng.

We currently seem to underestimate the size of functions with loops in them, both in terms of absolute code size and in the difficulties of dealing with such code. (Functions, for example, can be tail merged to further reduce codesize). At -Oz, we can then increase code size by inlining small loops multiple times.

This attempts to penalise functions with loops at -Oz by adding a CallPenalty for each top level loop in the function. It uses LI (and hence DT) to calculate the number of loops. As we are dealing with minsize, the inline threshold is small and functions at this point should be relatively small, making the construction of these cheap (although we really only care if/how many functions there are, so there may be a cheaper way to do that.)


https://reviews.llvm.org/D52716

Files:
  lib/Analysis/InlineCost.cpp
  test/Transforms/Inline/ARM/loop-memcpy.ll
  test/Transforms/Inline/ARM/loop-noinline.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52716.167688.patch
Type: text/x-patch
Size: 5810 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181001/a99039bc/attachment.bin>


More information about the llvm-commits mailing list