[InlineCost] Make cost-benefit decision explicit
authorWenlei He <aktoon@gmail.com>
Wed, 24 Mar 2021 21:33:45 +0000 (14:33 -0700)
committerWenlei He <aktoon@gmail.com>
Wed, 24 Mar 2021 23:10:58 +0000 (16:10 -0700)
commit6869e6c1e7f88d06a5db44e46933843247887040
tree8cd693f2f9b4e3e001d68492e8200382c70592bc
parent217f0f735afec57a51fa6f9ab863d4713a2f85e2
[InlineCost] Make cost-benefit decision explicit

With cost-benefit analysis for inlining, we bypass the cost-threshold by returning inline result from call analyzer early.

However the cost and threshold are still available from call analyzer, and when cost is actually higher than threshold, we incorrect set the reason.

The change makes the decision from cost-benefit analysis explicit. It's mostly NFC, except that it allows the priority-based sample loader inliner used by CSSPGO to use cost-benefit heuristic.

Differential Revision: https://reviews.llvm.org/D99302
llvm/lib/Analysis/InlineCost.cpp
llvm/test/Other/optimization-remarks-auto.ll