[SamplePGO] Keeping prof metadata for IndirectBrInst
authorspupyrev <spupyrev@fb.com>
Tue, 30 Mar 2021 17:38:58 +0000 (10:38 -0700)
committerWenlei He <aktoon@gmail.com>
Tue, 30 Mar 2021 17:44:48 +0000 (10:44 -0700)
commit22998738e8f78b447b04a7fd23efa4deaeda306b
treed4ca29757465e2028ecb03a4d6027bf8184945f6
parent3e3fc431dfe4c0f118f8e3d78bb3e7e96a7d4c35
[SamplePGO] Keeping prof metadata for IndirectBrInst

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.

Reviewed By: wmi, wenlei

Differential Revision: https://reviews.llvm.org/D99550
llvm/lib/IR/Metadata.cpp
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/test/Transforms/SampleProfile/Inputs/pseudo-probe-profile-metadata.prof [new file with mode: 0644]
llvm/test/Transforms/SampleProfile/pseudo-probe-profile-metadata.ll [new file with mode: 0644]