[BPI] Reduce the probability of unreachable edge to minimal value greater than 0
authorSerguei Katkov <serguei.katkov@azul.com>
Thu, 18 May 2017 06:11:56 +0000 (06:11 +0000)
committerSerguei Katkov <serguei.katkov@azul.com>
Thu, 18 May 2017 06:11:56 +0000 (06:11 +0000)
commitba831f78fd9f6f9d9d96cba699bc3e48b2b26630
tree7f45d4a9084668a336f8ef428bbcc298bc6a6de7
parentb10bff1183b8fcfe1a6625e353f9ebdef904ae7c
[BPI] Reduce the probability of unreachable edge to minimal value greater than 0

The probability of edge coming to unreachable block should be as low as possible.
The change reduces the probability to minimal value greater than zero.

The bug https://bugs.llvm.org/show_bug.cgi?id=32214 show the example when
the probability of edge coming to unreachable block is greater than for edge
coming to out of the loop and it causes incorrect loop rotation.

Please note that with this change the behavior of unreachable heuristic is a bit different
than others. Specifically, before this change the sum of probabilities
coming to unreachable blocks have the same weight for all branches
(it was just split over all edges of this block coming to unreachable blocks).
With this change it might be slightly different but not to much due to probability of
taken branch to unreachable block is really small.

Reviewers: chandlerc, sanjoy, vsk, congh, junbuml, davidxl, dexonsmith
Reviewed By: chandlerc, dexonsmith
Subscribers: reames, llvm-commits
Differential Revision: https://reviews.llvm.org/D30633

llvm-svn: 303327
llvm/lib/Analysis/BranchProbabilityInfo.cpp
llvm/test/Analysis/BranchProbabilityInfo/basic.ll
llvm/test/Analysis/BranchProbabilityInfo/deopt-intrinsic.ll
llvm/test/Analysis/BranchProbabilityInfo/noreturn.ll