[PATCH] D98094: [CSSPGO] Always use callsite samples as callsite probe counts.
Hongtao Yu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 5 18:02:45 PST 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.
For CS profile, the callsite count of previously inlined callees is populated with the entry count of the callees. Therefore when trying to get a weight for calliste probe after inlinining, the callsite count should always be used. The same fix has already been made for non-probe case.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D98094
Files:
llvm/lib/Transforms/IPO/SampleProfile.cpp
Index: llvm/lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -517,10 +517,13 @@
if (isa<BranchInst>(Inst) || isa<IntrinsicInst>(Inst) || isa<PHINode>(Inst))
return std::error_code();
- // If a direct call/invoke instruction is inlined in profile
- // (findCalleeFunctionSamples returns non-empty result), but not inlined here,
- // it means that the inlined callsite has no sample, thus the call
- // instruction should have 0 count.
+ // For non-CS profile, if a direct call/invoke instruction is inlined in
+ // profile (findCalleeFunctionSamples returns non-empty result), but not
+ // inlined here, it means that the inlined callsite has no sample, thus the
+ // call instruction should have 0 count.
+ // For CS profile, the callsite count of
+ // previously inlined callees is populated with the entry count of the
+ // callees.
if (!ProfileIsCS)
if (const auto *CB = dyn_cast<CallBase>(&Inst))
if (!CB->isIndirectCall() && findCalleeFunctionSamples(*CB))
@@ -545,13 +548,16 @@
if (!FS)
return std::error_code();
- // If a direct call/invoke instruction is inlined in profile
- // (findCalleeFunctionSamples returns non-empty result), but not inlined here,
- // it means that the inlined callsite has no sample, thus the call
- // instruction should have 0 count.
- if (const auto *CB = dyn_cast<CallBase>(&Inst))
- if (!CB->isIndirectCall() && findCalleeFunctionSamples(*CB))
- return 0;
+ // For non-CS profile, If a direct call/invoke instruction is inlined in
+ // profile (findCalleeFunctionSamples returns non-empty result), but not
+ // inlined here, it means that the inlined callsite has no sample, thus the
+ // call instruction should have 0 count.
+ // For CS profile, the callsite count of previously inlined callees is
+ // populated with the entry count of the callees.
+ if (!ProfileIsCS)
+ if (auto *CB = dyn_cast<CallBase>(&Inst))
+ if (!CB->isIndirectCall() && findCalleeFunctionSamples(*CB))
+ return 0;
const ErrorOr<uint64_t> &R = FS->findSamplesAt(Probe->Id, 0);
if (R) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98094.328710.patch
Type: text/x-patch
Size: 2241 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210306/39c2a3d2/attachment.bin>
More information about the llvm-commits
mailing list