Switch lowering: handle zero-weight branch probabilities
authorHans Wennborg <hans@hanshq.net>
Thu, 7 May 2015 15:47:15 +0000 (15:47 +0000)
committerHans Wennborg <hans@hanshq.net>
Thu, 7 May 2015 15:47:15 +0000 (15:47 +0000)
commitee25f1e872ae3073e8303b218e6c1253bda267c1
tree94fd76e8b73cc2d4c0ac124799e0483a7d0fb06b
parentbd58bdb7a61afeadd7c71d4b5351695a43d17d44
Switch lowering: handle zero-weight branch probabilities

After r236617, branch probabilities are no longer guaranteed to be >= 1. This
patch makes the swich lowering code handle that correctly, without bumping the
branch weights by 1 which might cause overflow and skews the probabilities.

Covered by @zero_weight_tree in test/CodeGen/X86/switch.ll.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236739 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp