Page MenuHomePhabricator

keeping prof metadata for IndirectBrInst
ClosedPublic

Authored by spupyrev on Mar 29 2021, 3:49 PM.

Details

Summary

Currently prof metadata with branch counts is added only for BranchInst and SwitchInst, but not for IndirectBrInst. As a result, BPI/BFI make incorrect inferences for indirect branches, which can be very hot.
This diff adds metadata for IndirectBrInst, in addition to BranchInst and SwitchInst.

Diff Detail

Event Timeline

spupyrev created this revision.Mar 29 2021, 3:49 PM
spupyrev requested review of this revision.Mar 29 2021, 3:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 29 2021, 3:49 PM
spupyrev edited the summary of this revision. (Show Details)Mar 29 2021, 3:51 PM
spupyrev added reviewers: wmi, wenlei, hoy.
spupyrev added a reviewer: davidxl.
wmi added a comment.Mar 29 2021, 4:26 PM

Thanks for the change. Could you add a test for it?

spupyrev updated this revision to Diff 334212.Mar 30 2021, 10:10 AM
  • added a test to verify the presense of metadata
  • lint suggestions
wmi accepted this revision.Mar 30 2021, 10:32 AM

LGTM.

llvm/test/Transforms/SampleProfile/Inputs/pseudo-probe-profile-metadata.prof
4–7
This revision is now accepted and ready to land.Mar 30 2021, 10:32 AM
wenlei accepted this revision.Mar 30 2021, 10:37 AM

Thanks for the fix, Sergey! Looking forward to more improvements on weight propagation and BFI inference. :) LGTM as well and I will push this one on your behalf.

This revision was landed with ongoing or failed builds.Mar 30 2021, 10:46 AM
This revision was automatically updated to reflect the committed changes.

Does llvm docs/langref need to be updated?

Does llvm docs/langref need to be updated?

prof metadata for indirected branch is supported according to the doc https://llvm.org/docs/BranchWeightMetadata.html, the change fixed an oversight in keeping such metadata. So doc should be good.