https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95699
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:2e0f4a18bc978c73624dd016e4cce229c2809c9c commit r11-1504-g2e0f4a18bc978c73624dd016e4cce229c2809c9c Author: Jakub Jelinek <ja...@redhat.com> Date: Thu Jun 18 12:11:09 2020 +0200 phiopt: Improve minmax optimization [PR95699] As discussed in the PR, the x < 0x80000000U to (int) x >= 0 optimization stands in the way of minmax_replacement optimization, so for comparisons with most of the constants it works well, but when the above mentioned optimization triggers, it is unable to do it. The match.pd (cond (cmp (convert? x) c1) (op x c2) c3) -> (op (minmax x c1) c2) optimization is able to look through that and this patch teaches minmax_replacement about it too. 2020-06-18 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/95699 * tree-ssa-phiopt.c (minmax_replacement): Treat (signed int)x < 0 as x > INT_MAX and (signed int)x >= 0 as x <= INT_MAX. Move variable declarations to the statements that set them where possible. * gcc.dg/tree-ssa/pr95699.c: New test.