https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114489
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #1) > <bb 3> [local count: 375809640]: > _3 = g1; > goto <bb 5>; [100.00%] > > <bb 4> [local count: 697932184]: > g2.1_2 = g2; > arr[0] = g2.1_2; > _8 = g1; > > <bb 5> [local count: 1073741824]: > # _6 = PHI <_8(4), _3(3)> > > Which does not optimize unless using -O2. > > This is on purpose. In that PRE is not enabled at -O1 but it is at -O2.