[PATCH] D96806: [SampleFDO] Stop indirect call promotion for the same target repeatedly

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 16 11:22:09 PST 2021


wmi created this revision.
wmi added reviewers: davidxl, wenlei, hoy.
Herald added subscribers: mgrang, hiraditya, kristof.beyls.
wmi requested review of this revision.
Herald added a project: LLVM.

Found a problem in indirect call promotion in sample loader pass. Currently if an indirect call is promoted for a target, and if the parent function is inlined into some other function, the indirect call can be promoted for the same target again. That is redundent which can harm performance and can cause excessive compile time in some extreme case.

The patch fixes the issue. If a target is promoted for an indirect call, the patch will write ICP metadata with the target call count being set to 0. In the later ICP in sample profile loader, if it sees a target has 0 count for an indirect call, it knows the target has been promoted and won't do indirect call promotion for the indirect call.

The fix brings 0.1~0.2% performance on our search benchmark.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96806

Files:
  llvm/include/llvm/ProfileData/InstrProf.h
  llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp
  llvm/lib/ProfileData/InstrProf.cpp
  llvm/lib/Transforms/IPO/SampleProfile.cpp
  llvm/test/Transforms/SampleProfile/Inputs/norepeated-icp.prof
  llvm/test/Transforms/SampleProfile/indirect-call.ll
  llvm/test/Transforms/SampleProfile/norepeated-icp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96806.324055.patch
Type: text/x-patch
Size: 14328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210216/2d5fe9ce/attachment-0001.bin>


More information about the llvm-commits mailing list