https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111043
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2023-08-20 Ever confirmed|0 |1 --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. In both cases copying the loop header gets rid of the loop which now hits the unreachable. In the first case before ch_vect we have: ``` <bb 2> [local count: 118111600]: e = 0; d = 2; goto <bb 6>; [100.00%] <bb 5> [local count: 955630224]: e.8_3 = (unsigned short) e_lsm.21_6; _4 = e.8_3 + 8; _5 = (short int) _4; <bb 6> [local count: 1073741824]: # e_lsm.21_6 = PHI <0(2), _5(5)> # e_lsm_flag.22_41 = PHI <0(2), 1(5)> _11 = (int) e_lsm.21_6; _12 = _11; if (_12 != 0) goto <bb 5>; [89.00%] else goto <bb 7>; [11.00%] ``` And ch_vect goes and copies bb6 for bb2 and things go down hill from there.