This is an archive of the discontinued LLVM Phabricator instance.

[llvm][NFC] Add an explicit 'ComputeFullInlineCost' API
ClosedPublic

Authored by mtrofin on Apr 23 2020, 10:09 AM.

Details

Summary

Added getInliningCostEstimate, which is essentially what getInlineCost
computes if passed default inlining params, and non-null ORE or
InlineParams::ComputeFullInlineCost.

Diff Detail

Event Timeline

mtrofin created this revision.Apr 23 2020, 10:09 AM

Why not passing the 'computeFullCost' as an additional parameter to InlineCostAnalyzer?

llvm/lib/Analysis/InlineCost.cpp
719

should it define 'shouldStop()' to return false?

mtrofin updated this revision to Diff 259958.Apr 24 2020, 12:23 PM
mtrofin marked an inline comment as done.

feedback

Why not passing the 'computeFullCost' as an additional parameter to InlineCostAnalyzer?

Because InlineCostAnalyzer's finalizeAnalysis looks at threshold (see lines 633-635).

Clarified documentation of the new API.

Perhaps add a 'ignoreThreshold' state in InlineCostANalyzer then? IgnoreThreshold implies 'ComputeFullCost' and will be honored by the finalize Method.

mtrofin updated this revision to Diff 259991.Apr 24 2020, 2:06 PM

simplified

Perhaps add a 'ignoreThreshold' state in InlineCostANalyzer then? IgnoreThreshold implies 'ComputeFullCost' and will be honored by the finalize Method.

That's simpler, indeed. Done.

looks good but I think the shouldStop method should check IgnoreThreshold as well.

davidxl accepted this revision.Apr 27 2020, 8:55 AM

lgtm

This revision is now accepted and ready to land.Apr 27 2020, 8:55 AM
This revision was automatically updated to reflect the committed changes.