[FS-AFDO] Load pseudo probe profile on MIR
authorHongtao Yu <hoy@fb.com>
Wed, 10 May 2023 17:28:33 +0000 (10:28 -0700)
committerHongtao Yu <hoy@fb.com>
Wed, 10 May 2023 18:29:37 +0000 (11:29 -0700)
commitb7d9322b4963e620dfd12246816e6f7b2da5fd88
treee849a9bd7532e01fac1e1537b2301c5fd97d6355
parent345fd0c10e90e85243265854ca8f6d9efa14f293
[FS-AFDO] Load pseudo probe profile on MIR

This change enables loading pseudo-probe based profile on MIR. Different from the IR profile loader, callsites are excluded from MIR profile loading since they are not assinged a FS discriminator. Using zero as the discriminator is not accurate and would undo the distribution work done by the IR loader based on pseudo probe distribution factor. We reply on block probes only for FS profile loading.

Some refactoring is done to the IR profile loader so that `getProbeWeight` can be shared by both loaders.

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D148584
llvm/include/llvm/IR/PseudoProbe.h
llvm/include/llvm/Transforms/IPO/SampleProfileProbe.h
llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
llvm/lib/CodeGen/MIRSampleProfile.cpp
llvm/lib/IR/PseudoProbe.cpp
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
llvm/test/CodeGen/X86/Inputs/fsloader-probe.afdo [new file with mode: 0644]
llvm/test/CodeGen/X86/fsafdo_probe2.ll [new file with mode: 0644]
llvm/test/Transforms/SampleProfile/pseudo-probe-stale-profile-matching.ll