[InstCombine] rearrange code for foldSelectBinOpIdentity; NFCI
authorSanjay Patel <spatel@rotateright.com>
Fri, 10 Aug 2018 20:30:35 +0000 (20:30 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 10 Aug 2018 20:30:35 +0000 (20:30 +0000)
commit85e17bb195232bce8ffdd3254166e9323bca24f6
treec6292d91cb55188018f33696dc379f912788479f
parent99a1ce97172ec0f849eba11dfd48e2fbaade412b
[InstCombine] rearrange code for foldSelectBinOpIdentity; NFCI

This is a retry of rL339439 with a fix for the problem that
caused the original commit to be reverted at rL339446.

That problem was that the compare can be integer while
the binop is FP or vice-versa, so we need to use the binop
type when we ask for the identity constant.

A test to guard against the problem was added at rL339453.

llvm-svn: 339469
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp