https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92131
--- Comment #10 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- > IIRC compare_values doesn't look at symbolic SSA names value-range but it > should do the same as fold would do for -7 < e.7_8 + (+INF - 1) which > IIRC doesn't fold this because combining the two constants results in an > overflow. So that's likely a bug in compare_values to say -1 here: > > /* Compute the difference between the constants. If it overflows or > underflows, this means that we can trivially compare the NAME with > it and, consequently, the two values with each other. */ > wide_int diff = wi::to_wide (cst) - wi::to_wide (inv); > if (wi::cmp (0, wi::to_wide (inv), sgn) > != wi::cmp (diff, wi::to_wide (cst), sgn)) > { > const int res = wi::cmp (wi::to_wide (cst), wi::to_wide (inv), > sgn); > return cst1 ? res : -res; > } IIRC this was directly copied from fold_comparison.