https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82394
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-10-04 CC| |rguenth at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- For optimizing this we rely on late unrolling but PRE in the pointer case messes with its cost model. At -O3 we avoid the PRE because we thing we might vectorize this and thus late unrolling works. So, make the data array large enough (>16 elements) and you'll see this not optimized at all. That said, we don't have any pass that is capable of "simulating" the loop and computing the resulting constant. What we can do is unroll everything and then have value-numbering do that on straingt-line code.