This is an archive of the discontinued LLVM Phabricator instance.

Import all inlined indirect call targets for SamplePGO.
ClosedPublic

Authored by danielcdh on Aug 11 2017, 2:05 PM.

Details

Summary

In the ThinLTO compilation, if a function is inlined in the profiling binary, we need to inline it before annotation. If the callee is not available in the primary module, a first step is needed to import that callee function. For the current implementation, if the call is an indirect call, which has been promoted to >1 targets and inlined, SamplePGO will only import one target with the largest sample count. This patch fixed the bug to import all targets instead.

Event Timeline

danielcdh created this revision.Aug 11 2017, 2:05 PM
tejohnson added inline comments.Sep 19 2017, 12:07 PM
lib/Transforms/IPO/SampleProfile.cpp
759–762

I'm not really following the flow of what is supposed to happen here. I see that the earlier code already does an iteration over findIndirectCallFunctionSamples - can/should this be combined with that?

test/Transforms/SampleProfile/import.ll
17–18

Update comment (foo1 and foo2 also)

danielcdh marked an inline comment as done.Sep 19 2017, 1:39 PM
danielcdh added inline comments.
lib/Transforms/IPO/SampleProfile.cpp
759–762

I'm planning to do that in a separate patch, in which I'll also move the InlineFunction call inside the loop too.

This revision is now accepted and ready to land.Sep 19 2017, 1:58 PM
danielcdh closed this revision.Sep 19 2017, 2:19 PM