[BranchProbability] Remove the restriction that known and unknown probabilities canno...
authorCong Hou <congh@google.com>
Thu, 17 Dec 2015 22:27:07 +0000 (22:27 +0000)
committerCong Hou <congh@google.com>
Thu, 17 Dec 2015 22:27:07 +0000 (22:27 +0000)
commit4c241849363d510a5d63c1c78989ef1fa15c1565
treefedd12500766e777c65c76eb6365a1490c138a7e
parentb96976e30de64e7ee32851c909e0ab909016b4ce
[BranchProbability] Remove the restriction that known and unknown probabilities cannot coexist when being normalized.

The current BranchProbability::normalizeProbabilities() forbids known and
unknown probabilities to coexist in the list. This was once used to help
capture probability exceptions but has caused some reported build
failures (https://llvm.org/bugs/show_bug.cgi?id=25838).

This patch removes this restriction by evenly distributing the complement
of the sum of all known probabilities to unknown ones. We could still
treat this as an abnormal behavior, but it is better to emit warnings in
our future profile validator.

Differential revision: http://reviews.llvm.org/D15548

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255934 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/BranchProbability.h
unittests/Support/BranchProbabilityTest.cpp