[CSSPGO] Fix incorrect probe distribution factor computation in top-down inliner
authorwlei <wlei@fb.com>
Wed, 7 Apr 2021 15:38:13 +0000 (08:38 -0700)
committerWenlei He <aktoon@gmail.com>
Wed, 7 Apr 2021 15:48:59 +0000 (08:48 -0700)
commit6d5132b426fbe23c5bc3e591ca2ca09a315d459b
tree721d90086f11eb7d3632ef4ce50c8f84f51eeb4d
parent93fb72575f7a70c0e095f7b278fd249260fe84a8
[CSSPGO] Fix incorrect probe distribution factor computation in top-down inliner

We see a regression related to low probe factor(0.01) which prevents some callsites being promoted in ICPPass and later cause the missing inline in CGSCC inliner. The root cause is due to redundant(the second) multiplication of the probe factor and this change try to fix it.

`Sum` does multiply a factor right after findCallSamples but later when using as the parameter in setProbeDistributionFactor, it multiplies one again.

This change could get ~2% perf back on mcf benchmark. In mcf, previously the corresponding factor is 1 and it's the recent feature introducing the <1 factor then trigger this bug.

Reviewed By: hoy, wenlei

Differential Revision: https://reviews.llvm.org/D99787
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/test/Transforms/SampleProfile/Inputs/pseudo-probe-icp-factor.prof [new file with mode: 0644]
llvm/test/Transforms/SampleProfile/pseudo-probe-icp-factor.ll [new file with mode: 0644]