<div dir="ltr">Hi Duncan<div><br></div><div>I committed this patch in the past after your approval, but it broke some others tests (see PR24377) that are not in the tree and I then reverted it. Later I investigated the bug and found the problem is that we could get zero edge weights from BPI (usually the zero weight is from test cases). When those zero weights come to MBPI, they will be turned into 16, which will lead to overflow when summing up weights. For example, if we have two edge weights 0 and UINT32_MAX, in the weight normalization function they are OK as the sum of them is not greater than UINT32_MAX. But when summing them up in MBPI we are adding 16 + UINT32_MAX instead of 0 + UINT32_MAX. This will lead to assertion failures.</div><div><br></div><div>As when BFI meets zero weights it will turn them into ones, I did the same trick in BPI by turning zero edge weights into ones. Now those test failures have disappeared.</div><div><br></div><div>Could you please take a look again at this patch? The additional update is in lib/Analysis/BranchProbabilityInfo.cpp and some test cases. Thank you very much!</div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">thanks,<br>Cong</div></div>
<br><div class="gmail_quote">On Tue, Aug 11, 2015 at 4:43 PM, Cong Hou <span dir="ltr"><<a href="mailto:congh@google.com" target="_blank">congh@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">congh removed rL LLVM as the repository for this revision.<br>
congh updated this revision to Diff 31882.<br>
congh added a comment.<br>
<br>
Update the patch by turning zero edge weights into one in BPI so that we won't get zero weights in BPI anymore.<br>
<span class=""><br>
<br>
<a href="http://reviews.llvm.org/D11442" rel="noreferrer" target="_blank">http://reviews.llvm.org/D11442</a><br>
<br>
Files:<br>
  include/llvm/CodeGen/MachineBasicBlock.h<br>
  include/llvm/CodeGen/MachineBranchProbabilityInfo.h<br>
</span>  lib/Analysis/BranchProbabilityInfo.cpp<br>
  lib/CodeGen/IfConversion.cpp<br>
  lib/CodeGen/MachineBasicBlock.cpp<br>
  lib/CodeGen/MachineBlockPlacement.cpp<br>
  lib/CodeGen/MachineBranchProbabilityInfo.cpp<br>
  test/CodeGen/X86/pr24377.ll<br>
  test/Transforms/SampleProfile/branch.ll<br>
  test/Transforms/SampleProfile/calls.ll<br>
  test/Transforms/SampleProfile/propagate.ll<br>
<br>
</blockquote></div><br></div>