This is an archive of the discontinued LLVM Phabricator instance.

Test case for indirect call bonus in inline cost analysis
Needs RevisionPublic

Authored by eraman on Dec 8 2015, 3:17 PM.

Details

Reviewers
chandlerc
davidxl
Summary

This is a test case for http://reviews.llvm.org/D14309 that uses the updated threshold for calculating indirect call bonus when baz->bar inlining would result in the indirect call passed to bar being resolved to foo.

To test the change, I needed the following properties:

  • Cost of baz->bar (C1) is greater than the threshold (T1 = 115) without applying any indirect call bonus
  • Let C2 be the cost of bar->foo inlining and T2 = InlineConstants::IndirectCallThreshold = 100). C1 > T1 + max(0, T2-C2), and
  • C1 <= T1 + max(0, 1.5*T2 - C2). The 1.5 comes from the addition of single BB bonus. When considering bar->foo inlining, CostAnalyzer's getThreshold() will return 1.5*T2.

This looks very brittle to me. If IndirectCallThreshold and the single BB bonus were options to opt, then this would be much better, imo.

Diff Detail

Repository
rL LLVM

Event Timeline

eraman updated this revision to Diff 42235.Dec 8 2015, 3:17 PM
eraman retitled this revision from to Test case for indirect call bonus in inline cost analysis.
eraman updated this object.
eraman added a reviewer: chandlerc.
eraman set the repository for this revision to rL LLVM.
eraman added subscribers: llvm-commits, davidxl.

Why not adding the two options? With the two new tuning options, the test case can also be reduced significantly.

eraman updated this object.Dec 8 2015, 3:57 PM
davidxl added inline comments.Jan 14 2016, 4:02 PM
test/Transforms/Inline/indirect-call-inlining-bonus.ll
9

Please reduce the size of this function.

Also mark this function as hot such that T2 further boosted for the indirect callsite.

43

Reduce the inline-threshold and size of the bar's body.

87

Define another function foo_cold, and add another callsite to bar with foo_cold passed in.

Since for indirect call foo_cold the T2 won't be increased, the second callsite to bar is not inlined.

chandlerc requested changes to this revision.Apr 6 2016, 11:09 PM
chandlerc added a reviewer: davidxl.
chandlerc edited edge metadata.

Marked David as a reviewer and marking that this needs changes so it doesn't show up in my review queue.

This revision now requires changes to proceed.Apr 6 2016, 11:09 PM