https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80275
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P2 Status|UNCONFIRMED |ASSIGNED Known to work| |5.4.1 Keywords| |missed-optimization Last reconfirmed| |2017-04-03 Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Ever confirmed|0 |1 Summary|Poor (but valid) code |[6/7 Regression] Poor (but |generated by optimizer |valid) code generated by |passing optimizer list to |optimizer passing optimizer |function |list to function Target Milestone|--- |6.4 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. In GCC 5 cunrolli is able to compute number of iterations of the loop(s) and unrolls them so we can optimize away the stuff. niter issue. trunk gets Analyzing # of iterations of loop 1 exit condition [(const int *) &D.15512 + 4, + , 4](no_overflow) != &MEM[(void *)&D.15512 + 12B] bounds on difference of bases: -18446744073709551615 ... 18446744073709551611 Applying pattern match.pd:148, generic-match.c:7290 result: # of iterations ((unsigned long) &MEM[(void *)&D.15512 + 12B] - (unsigned long) ((const int *) &D.15512 + 4)) /[ex] 4 & 4611686018427387903, bounded by 4611686018427387902 ... Loop 1 iterates at most -2 times. Loop 1 likely iterates at most -2 times. IL is quite similar. So we fail to simplify &MEM[&D.15512 + 12B] - (unsigned long) ((const int *) &D.15512 + 4)) for a start. I would guess at the associate case in fold-const.