https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116753
--- Comment #5 from Andrew Macleod <amacleod at redhat dot com> --- Theres room for some improvement in relations via PHIs that I will document here so I don't lose it. in VRP1 I see: Registering value_relation (x_7 > x_4) (bb5) at x_7 = x_4 + 1; Registering value_relation (x_8 > x_4) (bb4) at x_8 = x_4 + 2; Registering value_relation (x_9 > x_3) (bb8) at x_9 = x_3 + 3; then there is a PHI: # x_3 = PHI <x_8(4), x_7(5)> which in theory we can find a common relation between the arguemnts x_8 > x_4 x_7 > x_4 therefore we could conclude x_3 > x_4 Then there is another PHI: # x_1 = PHI <x_9(8), x_3(6), x_3(7)> x_9 > x_3, and the other operands are x_3, so we could conclude x_1 >= x_3 and transitively that means x_1 > x_4 Then we see # x_4 = PHI <x_1(9), 0(2)> the relations indicate x_1 > x_4, so with the other argmemnt being 0, we could then conclude that x_4 >= 0 as x_4 =x_1 means it is an increasing value. The PHI analyzer can make this final conclusion if it were to see this final relation, but establishing them may not be cheap. Something to experiemnt with.. I notice by VRP2 we have simplified things quite a bit, but that too late I guess.