https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92712
--- Comment #11 from Marc Glisse <glisse at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #10) > I know, it will be a small complication, sure, but it can be handled. Ah, I think I understand now. But still x=-1 a=INT_MAX a*x+x gives INT_MIN without overflow. Now a could be (int)((unsigned)b-1) where b is INT_MIN. But we don't want to generate b*x for that (INT_MIN*-1), since it overflows. So we would need to do the multiplication in some unsigned type. If we go there (do everything unsigned), we could do the transformation always, and restricting it is just a heuristic for when the signed type information might be more useful than the factorized form. > Using range info is certainly useful, but e.g. for this case with -1U it > will not be able to do anything, as the range of (int)(t-1U) will be > varying. So I think we want both. In this very particular case, it happens that we have if(t>0) dominating this stuff, which helps VRP.