[PATCH] D60903: [SampleFDO] Never set profile entry count to 0
Wei Mi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 19 10:19:43 PDT 2019
wmi added a comment.
Seems we did that all the time even before https://reviews.llvm.org/rL352001 (Since rL352001 <https://reviews.llvm.org/rL352001>, we did the update even in sample profile loader pass, when we found cold inline instance was not inlined by sample profile loader). Here is the code snippet before the refactoring involved in rL352001 <https://reviews.llvm.org/rL352001>.
298270 dehao /// Update the branch metadata for cloned call instructions.
298270 dehao static void updateCallProfile(Function *Callee, const ValueToValueMapTy &VMap,
322771 eraman const ProfileCount &CalleeEntryCount,
302597 eraman const Instruction *TheCall,
303574 tejohnson ProfileSummaryInfo *PSI,
303574 tejohnson BlockFrequencyInfo *CallerBFI) {
322771 eraman if (!CalleeEntryCount.hasValue() || CalleeEntryCount.isSynthetic() ||
322771 eraman CalleeEntryCount.getCount() < 1)
298270 dehao return;
322771 eraman auto CallSiteCount = PSI ? PSI->getProfileCount(TheCall, CallerBFI) : None;
298270 dehao uint64_t CallCount =
298270 dehao std::min(CallSiteCount.hasValue() ? CallSiteCount.getValue() : 0,
322771 eraman CalleeEntryCount.getCount());
298270 dehao
298270 dehao for (auto const &Entry : VMap)
298279 dblaikie if (isa<CallInst>(Entry.first))
298279 dblaikie if (auto *CI = dyn_cast_or_null<CallInst>(Entry.second))
322771 eraman CI->updateProfWeight(CallCount, CalleeEntryCount.getCount());
298270 dehao for (BasicBlock &BB : *Callee)
298270 dehao // No need to update the callsite if it is pruned during inlining.
298270 dehao if (VMap.count(&BB))
298270 dehao for (Instruction &I : BB)
298270 dehao if (CallInst *CI = dyn_cast<CallInst>(&I))
322771 eraman CI->updateProfWeight(CalleeEntryCount.getCount() - CallCount,
322771 eraman CalleeEntryCount.getCount());
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60903/new/
https://reviews.llvm.org/D60903
More information about the llvm-commits
mailing list