This optimization is derived from the optimisations in http://reviews.llvm.org/D5525
The optimisations in D5525 are of three kind. This patch contains only one kind (the Convert Two case switch to select), for review.
Checkout D5525 initial comment for a full description of all the optimisations.
nit: there is no need to repeat the function name in the comment. This goes for the other functions too.
And instead of "This is an helper function used to..." I'd just put "Helper function that adds CaseVal to the list of cases that generate Result."