llvm-project
llvm-project copied to clipboard
[InstCombine] missed fold x % y == x to x < y
found from https://github.com/gcc-mirror/gcc/commit/7ebe4eb29d8fc0167f98705b53b4fddb28f0cffb
int foo (unsigned int x, unsigned int y) { return x % y == x; }
foo:
mov eax, edi
xor edx, edx
div esi
xor eax, eax
cmp edx, edi
sete al
ret
should be:
int bar (unsigned int x, unsigned int y) { return x < y; }
bar:
xor eax, eax
cmp edi, esi
setb al
ret
https://godbolt.org/z/njWGvMvfj https://alive2.llvm.org/ce/z/3ryQaE
Hi, I'd like to work on this issue. Could you assign it to me?