https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114589
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #1) > Confirmed. > > Why didn't sink1 push _10, _13, _12, and _11 past the conditional here ... > If it did that I think it might have optimized correctly. Because then _12 would be 1, _13 would be 4 and _10 would be come `_11 + 4` and the loop induction variable would be going from _11 to `_11 + 4` then: ``` # __for_begin_15 = PHI <__for_begin_8(6), _11(5)> # .MEM_16 = PHI <.MEM_7(6), .MEM_4(D)(5)> # VUSE <.MEM_16> i_6 = *__for_begin_15; # .MEM_7 = VDEF <.MEM_16> # USE = nonlocal escaped # CLB = nonlocal escaped _Z1fiD.2782 (i_6); # PT = nonlocal __for_begin_8 = __for_begin_15 + 4; if (__for_begin_8 != _10) goto <bb 6>; [89.00%] else goto <bb 10>; [11.00%] ``` And we could figure out this loop is only gone through once only.