This is an archive of the discontinued LLVM Phabricator instance.

Explicitly promote indirect calls before sample profile annotation.
ClosedPublic

Authored by danielcdh on Jan 23 2017, 10:45 AM.

Details

Summary

In iterative sample pgo where profile is collected from PGOed binary, we may see indirect call targets promoted and inlined in the profile. Before profile annotation, we need to make this happen in order to annotate correctly on IR. This patch explicitly promotes these indirect calls and inlines them before profile annotation.

Event Timeline

danielcdh created this revision.Jan 23 2017, 10:45 AM
davidxl edited edge metadata.Jan 23 2017, 2:55 PM

can you split the refactoring code into a different patch?

davidxl added inline comments.Jan 24 2017, 10:06 AM
lib/Transforms/IPO/SampleProfile.cpp
619

should only be --> is limited with a single target.

1289

PromotedInsns is not used outside, is there a reason it can not be put into inlineHotFunctions as a local var?

danielcdh updated this revision to Diff 85608.Jan 24 2017, 10:30 AM
danielcdh marked 2 inline comments as done.

update

danielcdh updated this revision to Diff 85609.Jan 24 2017, 10:34 AM

add comments

This revision is now accepted and ready to land.Jan 24 2017, 11:21 AM
danielcdh closed this revision.Jan 24 2017, 1:16 PM
danielcdh reopened this revision.Jan 30 2017, 3:35 PM

reverted due to compile time breakage: needs legality check before promotion.

This revision is now accepted and ready to land.Jan 30 2017, 3:35 PM
danielcdh updated this revision to Diff 86360.Jan 30 2017, 3:35 PM

add legality check and according tests.

David,

I've fixed the bug and added the corresponding unittests. PTAL.

Thanks,
Dehao

davidxl added inline comments.Jan 30 2017, 5:02 PM
lib/Transforms/IPO/SampleProfile.cpp
656

better to return the failed reason and emit debug output.

danielcdh updated this revision to Diff 86443.Jan 31 2017, 9:12 AM
danielcdh marked an inline comment as done.

update

davidxl added inline comments.Jan 31 2017, 9:45 AM
lib/Transforms/IPO/SampleProfile.cpp
667

reset CalledFunction to null or continue?

danielcdh updated this revision to Diff 86448.Jan 31 2017, 9:50 AM
danielcdh marked an inline comment as done.

update

danielcdh closed this revision.Jan 31 2017, 10:00 AM