<div dir="ltr"><div>It's almost impossible for the sum of a function's raw count values to reach the max of uint64. If that happens, there must be something wrong.</div><div>We handle saturation in BFI weight where the type is int32.</div><div><br></div><div>-Rong</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 6, 2022 at 9:48 AM 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 inline comments.<br>
<br>
<br>
================<br>
Comment at: llvm/lib/ProfileData/InstrProfReader.cpp:1043<br>
+        continue;<br>
+      ValueSum += CountValue;<br>
+    }<br>
----------------<br>
Add handling of saturation using max.<br>
<br>
<br>
CHANGES SINCE LAST ACTION<br>
  <a href="https://reviews.llvm.org/D129001/new/" rel="noreferrer" target="_blank">https://reviews.llvm.org/D129001/new/</a><br>
<br>
<a href="https://reviews.llvm.org/D129001" rel="noreferrer" target="_blank">https://reviews.llvm.org/D129001</a><br>
<br>
</blockquote></div></div>