[all-commits] [llvm/llvm-project] 14756b: [SampleFDO] Don't mix up the existing indirect cal...

wmi-11 via All-commits all-commits at lists.llvm.org
Thu Mar 18 09:55:16 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 14756b70eeba76c0adeb73b82c4e69b35b74cdbe
      https://github.com/llvm/llvm-project/commit/14756b70eeba76c0adeb73b82c4e69b35b74cdbe
  Author: Wei Mi <wmi at google.com>
  Date:   2021-03-18 (Thu, 18 Mar 2021)

  Changed paths:
    M llvm/lib/Transforms/IPO/SampleProfile.cpp
    A llvm/test/Transforms/SampleProfile/Inputs/norepeated-icp-3.prof
    A llvm/test/Transforms/SampleProfile/norepeated-icp-3.ll

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

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.

Differential Revision: https://reviews.llvm.org/D98835




More information about the All-commits mailing list