https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26731
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- In GCC 9 and above we get: _2 = x_6(D) + 1; _7 = (unsigned int) n_1; _11 = _7 + 4294967295; _15 = (int) _11; _16 = n_1 > 0 ? _15 : 0; x_3 = _2 + _16; Which is okish, the loop has been removed but the above should be able to reduce further: # RANGE [1, 2147483647] NONZERO 2147483647 # n_1 = PHI <a_5(D)(3), 4(2)> # RANGE [-2147483647, 2147483647] _2 = x_6(D) + 1; # RANGE [1, 2147483647] NONZERO 2147483647 _7 = (unsigned int) n_1; # RANGE [0, 2147483646] NONZERO 2147483647 _11 = _7 + 4294967295; # RANGE [0, 2147483646] NONZERO 2147483647 _15 = (intD.9) _11; # RANGE [0, 2147483646] NONZERO 2147483647 _16 = n_1 > 0 ? _15 : 0; x_3 = _2 + _16; The COND_EXPR should just converted into _15 but we don't ... VRP should have done that ....