This is an archive of the discontinued LLVM Phabricator instance.

[PSI] Use zero function entry count info when getting profile count for calls
Needs ReviewPublic

Authored by scui on Aug 23 2023, 1:09 PM.

Details

Reviewers
davidxl
w2yehia
Summary

Currently the BFI basic block ProfileCount is used when trying to getProfileCount for callsites. There are situations this count information may be inaccurate, for example, when the callsite code region is a result of inlining of a function without profile information to the caller which is profiled. This is to use the function entry count information from the called function when it contains the profile information and its function entry count is zero.

Diff Detail

Event Timeline

scui created this revision.Aug 23 2023, 1:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2023, 1:09 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
scui requested review of this revision.Aug 23 2023, 1:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2023, 1:09 PM

I assume this is with instrumentation based FDO. Why are there functions without profile?

llvm/lib/Analysis/ProfileSummaryInfo.cpp
93

Put this in the else case for the following if(BFI) {} check below.

scui added a comment.Aug 23 2023, 1:39 PM

I assume this is with instrumentation based FDO. Why are there functions without profile?

Yes. this is with instrumentation based FDO. This can happen when customers are not profiling all the files of their applications.