Motivational case is highlighted in PR17564:
int f(int x) { return (x & 1) || (x & 2); }
If the function return type is bool, then the IR is just and+icmp.
But if it is int, then it has select, and whatnot.
https://godbolt.org/g/uTJVVo
If one analyzes -print-after-all, thing appear to go bad when we fold zext into phi.
If we don't do that, then the behavior is the same as with i1, and PR17564 is fixed.
Also, the second part is needed, to get rid of select if possible,
e.g. https://godbolt.org/g/iAYRup, but that is another issue.
Now, i'm not quite sure whether *this* fix is correct?
Two other tests changed, but those changes do not look harmful?
Testing: ninja check-llvm
Fixes PR17564.
If this makes sense i'll commit test changes as NFC, and rebase.