https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103986
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This might be a latent bug in GCC 11 even. The only difference in the IR before unswitch (besides BB reordering) is: GCC 10.x: <bb 5> [local count: 1073741824]: # it$m_pos$x_21 = PHI <0(4), _26(13)> if (it$4_29 == 3) goto <bb 11>; [11.00%] else goto <bb 6>; [89.00%] GCC 11+: <bb 10> [local count: 1073741824]: # it$m_pos$x_19 = PHI <0(9), _24(13)> if (it$4_32 != 3) goto <bb 3>; [89.00%] else goto <bb 11>; [11.00%] Note bb 11 is the return.