Hello, > >Now, if your argument is that following the LIA-1 standard will prevent > >optimizations that could otherwise be made if one followed only the C > >standard, that's a reasonable argument, but it should not be couched as > >if it implies that preventing the optimizations would not be following > >the C standard. > > I continue to suspect that the gains from this optimization are minimal > to non-existent in practice.
the majority of loop optimizations work only assuming that induction variables do not overflow. This assumption can sometimes be verified using quite expensive analyses of the loop code, or in majority of cases easily derived if the induction variables are either signed or pointers (where the standard allows us to assume that the arithmetics does not overflow). Note that there was even a serious discussion about enabling -funsafe-loop-optimizations by default at some optimization level, thus making us assert that *no* induction variables (regardless of signedness) overflow; which IIRC is what some other compilers do. IMHO, using loops relying on the behavior of overflow of an induction variable (*) is an ugly hack and whoever writes such a code does not deserve for his program to work. Zdenek (*) especially without bothering to verify what the language standard says about that