[InlineCost] cleanup calculations of Cost and Threshold
authorFedor Sergeev <fedor.sergeev@azul.com>
Wed, 26 Jun 2019 13:24:24 +0000 (13:24 +0000)
committerFedor Sergeev <fedor.sergeev@azul.com>
Wed, 26 Jun 2019 13:24:24 +0000 (13:24 +0000)
commit1a3dc761860d620ac8ed7e32a4285952142f780b
treeb290d2280cfc3f4b9be36e7de9fcdc1bfc186134
parent09bc66576600d06ce5cbcd55731f04a93adfdcfd
[InlineCost] cleanup calculations of Cost and Threshold

Summary:
Doing better separation of Cost and Threshold.
Cost counts the abstract complexity of live instructions, while Threshold is an upper bound of complexity that inlining is comfortable to pay.
There are two parts:
     - huge 15K last-call-to-static bonus is no longer subtracted from Cost
       but rather is now added to Threshold.

       That makes much more sense, as the cost of inlining (Cost) is not changed by the fact
       that internal function is called once. It only changes the likelyhood of this inlining
       being profitable (Threshold).

     - bonus for calls proved-to-be-inlinable into callee is no longer subtracted from Cost
       but added to Threshold instead.

While calculations are somewhat different,  overall InlineResult should stay the same since Cost >= Threshold compares the same.

Reviewers: eraman, greened, chandlerc, yrouban, apilipenko
Reviewed By: apilipenko
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60740

llvm-svn: 364422
llvm/lib/Analysis/InlineCost.cpp
llvm/test/LTO/Resolution/X86/diagnostic-handler-remarks-with-hotness.ll
llvm/test/LTO/Resolution/X86/diagnostic-handler-remarks.ll
llvm/test/LTO/X86/diagnostic-handler-remarks-with-hotness.ll
llvm/test/LTO/X86/diagnostic-handler-remarks.ll
llvm/test/Transforms/Inline/ARM/inline-fp.ll