Constant hoisting may have hidden a constant behind a bitcast so that it isn't folded into its users. However, this prevents BPI from calculating some of its heuristics that are based upon constant values. So, I've added a simple helper function to look through these casts.
LGTM. Looking at it it does make me wonder if we should handle things that aren't ConstantInt, e.g.
bitcast <2 x i16> <i16 0, i16 0> to i32
is still zero, though I'm guessing things like this actually probably never happen and this commit is fine as it is anyway.