[all-commits] [llvm/llvm-project] 077bae: [llvm-profdata] Use flattening sample profile in p...

xur-llvm via All-commits all-commits at lists.llvm.org
Tue Nov 29 22:37:00 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 077baefc998dd55ba1b91d9c9e284ce5a8e0216e
      https://github.com/llvm/llvm-project/commit/077baefc998dd55ba1b91d9c9e284ce5a8e0216e
  Author: Rong Xu <xur at google.com>
  Date:   2022-11-29 (Tue, 29 Nov 2022)

  Changed paths:
    M llvm/include/llvm/ProfileData/SampleProf.h
    A llvm/test/tools/llvm-profdata/Inputs/flatten_instr.proftext
    A llvm/test/tools/llvm-profdata/Inputs/flatten_sample.proftext
    A llvm/test/tools/llvm-profdata/suppl-instr-with-sample-flatten.test
    M llvm/tools/llvm-profdata/llvm-profdata.cpp

  Log Message:
  -----------
  [llvm-profdata] Use flattening sample profile in profile supplementation

We need to flatten the SampleFDO profile in profile supplementation
because the InstrFDO profile does not have inlined callsite counters.
Without flattening profile, FDO optimizations are not stable:
we will not supplement the second generation profile when the modified
functions are all inlined.

This patch fixes this issue: we will flatten the profile for functions
that appears in FDO profile.

Note that we only need to find the hot/warm functions in SampleFDO
profile, so we will not perform a full flatten. We will use
a DFS traversal to compute the accumulated entry count and max bodycount.
This is much cheaper than full flattening.

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




More information about the All-commits mailing list