https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94414
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-12-14 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Severity|normal |enhancement Component|c++ |tree-optimization --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- To me there looks like an unrolling not happening: <bb 3> [local count: 1014686026]: # __first_35 = PHI <__first_15(4), &MEM <const int[4]> [(void *)&arr + 8B](2)> _14 = MEM[(const int &)__first_35]; if (_14 <= 5) goto <bb 4>; [94.50%] else goto <bb 5>; [5.50%] <bb 4> [local count: 958878296]: __first_15 = __first_35 + 4; if (&MEM <const struct array> [(void *)&arr + 16B] != __first_15) goto <bb 3>; [94.50%] else goto <bb 5>; [5.50%] But from what I can tell it is we unroll the one loop and then we can't unroll this one until much later on. It is really interesting testcase.