[PATCH] D102537: [SampleFDO] Overwrite branch weight annotated in previous pass.
Hongtao Yu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 14 14:43:51 PDT 2021
hoy created this revision.
Herald added subscribers: wenlei, hiraditya.
hoy requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Sample profile loader can be run in both LTO prelink and postlink. Currently the counts annoation in postilnk doesn't fully overwrite what's done in prelink. I'm adding a switch (`-overwrite-existing-weights=1`) to enable a full overwrite, which includes:
1. Clear old metadata for calls when their parent block has a zero count. This could be caused by prelink code duplication.
2. Clear indirect call metadata if somehow all the rest targets have a sum of zero count.
3. Overwrite branch weight for basic blocks.
When counts are accurate, I was seeing #1 and #2 help reduce code size by preventing post-sample ICP and CGSCC inliner working on obselete metedata.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D102537
Files:
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/test/Transforms/SampleProfile/branch.ll
llvm/test/Transforms/SampleProfile/pseudo-probe-profile-metadata-2.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102537.345570.patch
Type: text/x-patch
Size: 8129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210514/f632f739/attachment.bin>
More information about the llvm-commits
mailing list