When computing branch weights in BPI, we used to disallow branches with
weight 0. This is a minor nuisance, because a branch with weight 0 is
different to "don't have information". In the context of
instrumentation, it may mean "never executed", in the context of
sampling, it means "never or seldom executed".
In allowing 0 weight branches, I ran into issues with the switch
expansion code in selection DAG. It is currently hardwired to not handle
branches with weight 0. To maintain the current behaviour, I changed it
to use 1 when it finds 0, but perhaps the algorithm needs changes to
tolerate branches with weight zero.
Hans, could you take a look at the code I added to compensate for 0-weight
branches in the switch lowering code? I've tried to look for a better
place to add the flooring code, but couldn't find it.
The rest of the patch just mechanically adjusts for branches that now have
the correct weight set to 0.