[PATCH] D50435: [Inliner] Attribute callsites with inline remarks

Yevgeny Rouban via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 8 04:08:30 PDT 2018


yrouban created this revision.
yrouban added reviewers: xbolva00, tejohnson, apilipenko.
Herald added a subscriber: eraman.

Sometimes reading an output *.ll file it is not easy to understand why some callsites are not inlined. We can read output of inline remarks (option --pass-remarks-missed=inline) and try correlating its messages with the callsites.

An easier way proposed by this patch is to add to every callsite processed by Inliner an attribute with the latest message that describes the cause of not inlining this callsite. The attribute is called //inline-remark//. By default this feature is off. It can be switched on by the option //-inline-remark-attribute//.

For example in the provided test the result method //@test1// has two callsites //@bar// and inline remarks report different inlining missed reasons:

  remark: <unknown>:0:0: bar not inlined into test1 because too costly to inline (cost=-5, threshold=-6)
  remark: <unknown>:0:0: bar not inlined into test1 because it should never be inlined (cost=never): recursive

It is not clear which remark correspond to which callsite. With the inline remark attribute enabled we get the reasons attached to their callsites:

  define void @test1() {
    call void @bar(i1 true) #0
    call void @bar(i1 false) #2
    ret void
  }
  attributes #0 = { "inline-remark"="(cost=-5, threshold=-6)" }
  ..
  attributes #2 = { "inline-remark"="(cost=never): recursive" }


https://reviews.llvm.org/D50435

Files:
  lib/Transforms/IPO/Inliner.cpp
  test/Transforms/Inline/inline-remark.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50435.159676.patch
Type: text/x-patch
Size: 7059 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180808/d161c052/attachment.bin>


More information about the llvm-commits mailing list