For both operands are unsigned, the following optimizations are valid, and missing:
- X > Y && X != 0 --> X > Y
- X > Y || X != 0 --> X != 0
- X <= Y || X != 0 --> true
- X <= Y || X == 0 --> X <= Y
- X > Y && X == 0 --> false
unsigned foo(unsigned x, unsigned y) { return x > y && x != 0; }
should fold to x > y, but I found we haven't done it right now.
besides, unsigned foo(unsigned x, unsigned y) { return x < y && y != 0; }
Has been folded to x < y, so there may be a bug.
I analyzed out that there may be a bit problematic logic at line 1312 in the InstructionSimplify.cpp file.
Depends on D48000.
So was the old one a harmless typo that rendered that if useless, was that a miscompile (needs test then),
or is the RHS of the diff is a new case (so the old one is a standalone case, too, and needs a test)?