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.