This is an archive of the discontinued LLVM Phabricator instance.

Add call branch annotation for ICP promoted direct call in SamplePGO mode.
ClosedPublic

Authored by danielcdh on Feb 22 2017, 5:03 PM.

Details

Summary

SamplePGO uses branch_weight annotation to represent callsite hotness. When ICP promotes an indirect call to direct call, we need to make sure the direct call is annotated with branch_weight in SamplePGO mode, so that downstream function inliner can use hot callsite heuristic.

Event Timeline

danielcdh created this revision.Feb 22 2017, 5:03 PM
xur edited edge metadata.Feb 22 2017, 5:52 PM

Not familiar with samplePGO. Are the counters always annotated in the call sites (or the sampled BB)?
The call counts cannot be inferred from entry counts and the branch-weight?
If this the way samplePGO works, this looks fine to me.

Yes, SamplePGO annotate all hot callsites with absolute branch weight to prevent BFI from messing up with inaccurate branch probability.

xur accepted this revision.Feb 23 2017, 9:53 AM
This revision is now accepted and ready to land.Feb 23 2017, 9:53 AM
davidxl added inline comments.Feb 23 2017, 1:42 PM
lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
526

document this is needed for sample PGO callsite hotness.

davidxl accepted this revision.Feb 23 2017, 1:46 PM

lgtm

danielcdh closed this revision.Feb 23 2017, 2:26 PM