[llvm] r259915 - CallAnalyzer::analyzeCall: change the condition back to "Cost < Threshold"
Hans Wennborg via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 23 16:26:43 PST 2016
If Cost = 0 doesn't mean inlining the function has zero cost, that seems broken.
I think eraman knows this code. Maybe he wants to take a look?
On Mon, Feb 22, 2016 at 9:11 PM, Akira Hatanaka via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Hi Hans,
> This commit (or r252595) causes the inliner to inline functions you don't
> want to inline (large functions) in some cases. For example, if you compile
> the attached test case with "opt -inline", function "callee" will always get
> inlined even after replicating the inline-asm instruction in the last basic
> block a large number of times. This happens because the loop in
> CallAnalyzer::analyzeCall that visits the basic blocks of "callee" breaks
> out when Cost exceeds Threshold, and when that happens Cost happens to be 0.
> In this case Cost doesn't represent the true cost of the function (Cost<=0
> doesn't mean "inlining is free").
> Could you take a look?
> On Fri, Feb 5, 2016 at 12:32 PM, Hans Wennborg via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>> Author: hans
>> Date: Fri Feb 5 14:32:42 2016
>> New Revision: 259915
>> URL: http://llvm.org/viewvc/llvm-project?rev=259915&view=rev
>> CallAnalyzer::analyzeCall: change the condition back to "Cost < Threshold"
>> In r252595, I inadvertently changed the condition to "Cost <= Threshold",
>> which caused a significant size regression in Chrome. This commit
>> Modified: llvm/trunk/lib/Analysis/InlineCost.cpp
>> --- llvm/trunk/lib/Analysis/InlineCost.cpp (original)
>> +++ llvm/trunk/lib/Analysis/InlineCost.cpp Fri Feb 5 14:32:42 2016
>> @@ -1392,7 +1392,7 @@ bool CallAnalyzer::analyzeCall(CallSite
>> else if (NumVectorInstructions <= NumInstructions / 2)
>> Threshold -= (FiftyPercentVectorBonus - TenPercentVectorBonus);
>> - return Cost <= std::max(0, Threshold);
>> + return Cost < std::max(1, Threshold);
>> #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
More information about the llvm-commits