[all-commits] [llvm/llvm-project] db0d7d: [SampleFDO][NFC] Refactor SampleProfileLoader to r...

xur-llvm via All-commits all-commits at lists.llvm.org
Wed Feb 10 13:47:40 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: db0d7d0ba9f9d6c03263234beabb1c0b8435a445
      https://github.com/llvm/llvm-project/commit/db0d7d0ba9f9d6c03263234beabb1c0b8435a445
  Author: Rong Xu <xur at google.com>
  Date:   2021-02-10 (Wed, 10 Feb 2021)

  Changed paths:
    M llvm/lib/Transforms/IPO/SampleProfile.cpp

  Log Message:
  -----------
  [SampleFDO][NFC] Refactor SampleProfileLoader to reuse in CodeGen

Break SampleProfileLoader into to a base and a derived class.
Base class (SampleProfileLoaderBaseImpl) includes the common
code for IR and MachineIR (CodeGen) sample loader.
It will be templatelized in the later patch.

Inline and Probe related code will remain in the derived class of
SampleProfileLoader and stays in SampleProfile.cpp.

We need to refactor some functions:
(1) getInstWeight() to enable the code sharing -- put the core into
getInstWeightImpl().
(2) emitAnnotation() and propagateWeights() to carve out the code
specific to SampleProfileLoader.
(3) make getInstWeight() and findFunctionSamples() virtual and override
in SampleProfileLoader as they need to access the fields in the derived
class.

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




More information about the All-commits mailing list