[PATCH] D98835: [SampleFDO] Don't mix up the existing indirect call value profile with the new value profile annotated after inlining.

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 17 18:26:58 PDT 2021


wmi created this revision.
wmi added reviewers: davidxl, wenlei, hoy.
Herald added a subscriber: hiraditya.
wmi requested review of this revision.
Herald added a project: LLVM.

In https://reviews.llvm.org/D96806 and https://reviews.llvm.org/D97350, we use the magic number -1 in the value profile to avoid repeated indirect call promotion to the same target for an indirect call. Function updateIDTMetaData is used to mark an target as being promoted in the value profile with the magic number. updateIDTMetaData is also used to update the value profile when an indirect call is inlined and new inline instance profile should be applied. For the second case, currently updateIDTMetaData mixes up the existing value profile of the indirect call with the new profile, leading to the problematic senario that a target count is larger than the total count in the value profile.

The patch fixes the problem. When updateIDTMetaData is used to update the value profile after inlining, all the values in the existing value profile will be dropped except the values with the magic number counts.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98835

Files:
  llvm/lib/Transforms/IPO/SampleProfile.cpp
  llvm/test/Transforms/SampleProfile/Inputs/norepeated-icp-3.prof
  llvm/test/Transforms/SampleProfile/norepeated-icp-3.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98835.331436.patch
Type: text/x-patch
Size: 6376 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210318/ae8eb939/attachment.bin>


More information about the llvm-commits mailing list