[all-commits] [llvm/llvm-project] e503fd: [AutoFDO] Properly merge context-sensitive profile...

WenleiHe via All-commits all-commits at lists.llvm.org
Thu Dec 5 15:59:35 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: e503fd85d3ac9d3e1493a7a63bc43c6939e132cc
      https://github.com/llvm/llvm-project/commit/e503fd85d3ac9d3e1493a7a63bc43c6939e132cc
  Author: Wenlei He <aktoon at gmail.com>
  Date:   2019-12-05 (Thu, 05 Dec 2019)

  Changed paths:
    M llvm/include/llvm/ProfileData/SampleProf.h
    M llvm/include/llvm/ProfileData/SampleProfReader.h
    M llvm/lib/Transforms/IPO/SampleProfile.cpp
    M llvm/test/CodeGen/X86/insert-prefetch-inline.afdo
    M llvm/test/Transforms/SampleProfile/Inputs/einline.prof
    M llvm/test/Transforms/SampleProfile/Inputs/inline-callee-update.prof
    A llvm/test/Transforms/SampleProfile/Inputs/inline-mergeprof.prof
    A llvm/test/Transforms/SampleProfile/inline-mergeprof.ll

  Log Message:
  -----------
  [AutoFDO] Properly merge context-sensitive profile of inlinee back to outlined function

Summary:
When sample profile loader decides not to inline a previously inlined call-site, we adjust the profile of outlined function simply by scaling up its profile counts by call-site count. This means the context-sensitive profile of that inlined instance will be thrown away. This commit try to keep context-sensitive profile for such cases:

 - Instead of scaling outlined function's profile, we now properly merge the FunctionSamples of inlined instance into outlined function, including all recursively inlined profile.
 - Instead of adjusting the profile for negative inline decision at the end of the sample profile loader pass, we do the profile merge right after processing each function. This change paired with top-down ordering of annotation/inline-replay (a separate diff) will make sure we recursively merge profile back before the profile is used for annotation and inline replay.

A new switch -sample-profile-merge-inlinee is added to enable the new profile merge for tuning. It should be the default behavior eventually.

Reviewers: wmi, davidxl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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




More information about the All-commits mailing list