http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46957
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-16 09:31:43 UTC --- Indeed, that's another possibility, could handle even more complex expressions. On the other side, it makes sense to do it only if the initial value is constant and thus we can expect the result is constant too, otherwise we might risk creating too expensive operation instead of the loop (especially when the loop doesn't roll too many times). And we'd need some peel limit for that too, as for a couple of passes until optimizers clean stuff up we could increase number of stmts a lot.