http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46186
--- Comment #15 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2010-10-26 17:15:31 UTC --- > For sum += 2 or sum += b sccp handles this, so I wonder whether it couldn't > handle even the sum += a case. 2 and b are constants while a is not. For constants you have to know that the sum is cst*nloop, while if a is incremented you have to know that it is related to nloop*(nloop+1)/2 (and if you use sum += a*a, nloop*(nloop+1)*(2*nloop+1)/6, if sum += a*a*a, nloop^2*(nloop+1)^2/4 and so on). However is it worth the work?