[CSSPGO] Factor out common part for CSSPGO inline and AFDO inline
authorWenlei He <aktoon@gmail.com>
Wed, 20 Jan 2021 07:29:14 +0000 (23:29 -0800)
committerWenlei He <aktoon@gmail.com>
Tue, 2 Feb 2021 15:55:08 +0000 (07:55 -0800)
commit1645f465be85223e9f5b6303a3e5e0e491fd819f
treec58f934a0b547be8bacc1dfa6c7a9c21334a68b3
parented8943c08769082f4ce5e7682a4ff53ae25bee36
[CSSPGO] Factor out common part for CSSPGO inline and AFDO inline

Refactoring SampleProfileLoader::inlineHotFunctions to use helpers from CSSPGO inlining and reduce similar code in the inlining loop, plus minor cleanup for AFDO path.

This is resubmit of D95024, with build break and overtighten assertion fixed.

Test Plan:
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/test/Transforms/SampleProfile/pseudo-probe-inline.ll
llvm/test/Transforms/SampleProfile/remarks.ll