<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:times new roman,serif"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 22, 2020 at 2:53 PM David Li via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">davidxl added a comment.<br>
<br>
The PGOUse pass can choose not to annotate any branches with total weights == 0. Now the question becomes how do we tell PGOUse pass whether the entry should be set to 0 or leave it not set. There are two ways to do it (to signal it is not really cold, but unknown):<br>
<br>
1. Remove the function from the indexed format profile;<br>
2. set all counts to some sentinel value such as -1.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-family:"times new roman",serif">Yes, in this way we can move the function to .text section from .text.unlikely, but it is still not ideal if the function is hot. If we can set the entry count to be a hot value based on the entry count in sample profile, we may be able to boost its inlining and unrolling inside, and also put it in .text.hot.</div><br></div><div><div class="gmail_default" style="font-family:"times new roman",serif">How about letting llvm-profdata choose based on profile version? If the profile version indicates it always contains entry count, llvm-profdata will update the entry count. If the profile version indicates it may not always contain the entry count, llvm-profdata will remove the function with all zero values if it finds the function to be hot/warm in sample profile. It will also boost the counters in function with non-zero value using total or max count. In this way, the feature can support any profile version. </div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
Repository:<br>
rL LLVM<br>
<br>
CHANGES SINCE LAST ACTION<br>
<a href="https://reviews.llvm.org/D81981/new/" rel="noreferrer" target="_blank">https://reviews.llvm.org/D81981/new/</a><br>
<br>
<a href="https://reviews.llvm.org/D81981" rel="noreferrer" target="_blank">https://reviews.llvm.org/D81981</a><br>
<br>
<br>
<br>
</blockquote></div></div>