[PATCH] Fix information loss in branch probability computation.

Diego Novillo dnovillo at google.com
Fri May 1 13:21:23 PDT 2015


Hi dexonsmith,

This addresses PR 22718. When branch weights are too large, they were
being clamped to the range [1, MaxWeightForBB]. But this clamping is
only applied to edges that go outside the range, so it distorts the
relative branch probabilities.

This patch changes the weight calculation to scale every branch so the
relative probabilities are preserved.

The patch fixes an existing test that had slightly wrong branch
probabilities due to the previous clamping. It now gets branch weights
scaled accordingly.

http://reviews.llvm.org/D9442

Files:
  lib/Analysis/BranchProbabilityInfo.cpp
  test/Analysis/BranchProbabilityInfo/pr22718.ll
  test/CodeGen/X86/MachineBranchProb.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9442.24827.patch
Type: text/x-patch
Size: 7497 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150501/9ab7c1a5/attachment.bin>


More information about the llvm-commits mailing list