[PATCH] D36722: [InlineCost] Simplify the cold attribute handling in inline-cost.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 14 17:08:15 PDT 2017


chandlerc created this revision.
Herald added subscribers: mcrosier, sanjoy.

The inline cost analysis used the cold attribute but only when
ProfileSummaryInfo was available even though that attribute isn't part
of the profile info for the module and is independently available.

This patch lifts the check up into the generic cold callsite detection
logic as for *cold* functions, we routinely treat *all* call sites as
cold. In fact, we shape the probabilities and frequencies this way if
there is any CFG, but sometimes (such as single-basic-block functions)
there isn't any CFG that can exhibit this. Moreover, it seems much
simpler and direct to just query for the cold attribute and be done with
it, skipping all of the probability queries.

This also simplifies what is necessary to write a test using the cold
attribute as now you don't have to remember to run the
profile-summary-info analysis in the new PM. I spent quite some time
confused because I didn't have that analysis around.

Also remove the redundant thresholds between the two ways of detecting
cold calls. Originally there was some concern that we would want to tune
these thresholds independently but so far no such need has arisen and it
is easy enough to add back in. I'd rather have the simpler system in the
interim that is also easier to understand and reason about.

This should be essentially a no-op for most users of LLVM, but will
result in an API simplification and a test simplification.


https://reviews.llvm.org/D36722

Files:
  include/llvm/Analysis/InlineCost.h
  lib/Analysis/InlineCost.cpp
  test/Transforms/Inline/bfi-update.ll
  test/Transforms/Inline/inline-cold-callsite-pgo.ll
  test/Transforms/Inline/inline-cold-callsite.ll
  test/Transforms/Inline/pr26698.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36722.111101.patch
Type: text/x-patch
Size: 6771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170815/eb983ac8/attachment.bin>


More information about the llvm-commits mailing list