https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68963
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Known to work| |4.7.4
Keywords| |wrong-code
Last reconfirmed| |2015-12-18
Component|c |tree-optimization
CC| |rguenth at gcc dot gnu.org
Ever confirmed|0 |1
Summary|O3 vs. O2 discards part of |[4.9/5/6 Regression] O3 vs.
|loop and terminates early |O2 discards part of loop
| |and terminates early
Target Milestone|--- |4.9.4
Known to fail| |4.8.5, 4.9.3, 5.3.0, 6.0
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. This is complete peeling doing sth wrong:
test123.c:10:2: note: loop with 4 iterations completely unrolled
Last iteration exit edge was proved true.
We have bogus range info in .pcom:
<bb 5>:
# RANGE [0, 3] NONZERO 3
# i_23 = PHI <0(4), i_20(9)>
if (K_5(D) > i_23)
goto <bb 6>;
else
goto <bb 7>;
...
<bb 8>:
# RANGE [1, 4] NONZERO 7
i_20 = i_23 + 1;
if (i_20 < _21)
goto <bb 9>;
else
goto <bb 3>;
<bb 9>:
goto <bb 5>;
but disabling VRP1 doesn't help here (it uses niter analysis to derive the
above so niter analysis is wrong in some way).