Make the following simplifications: X <= MAX(X, Y) -> true X > MAX(X, Y) -> false X >= MIN(X, Y) -> true X < MIN(X, Y) -> false This fixes PR96708. Tested on x86_64-pc-linux-gnu.
bool f(int a, int b) { int tmp = (a < b) ? b : a; return tmp >= a; } Code without the patch: vmovd xmm0,edi vmovd xmm1,esi vpmaxsd xmm0,xmm0,xmm1 vmovd eax,xmm0 cmp eax,edi setge al ret Code with the patch: mov eax,0x1 ret Eugene
0001-Optimize-max-pattern-with-comparison.patch
Description: 0001-Optimize-max-pattern-with-comparison.patch