https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103288
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #5) > Before phiopt, we have: > if (func_14_uli_8.0_1 != 0) > goto <bb 3>; [50.00%] > else > goto <bb 4>; [50.00%] > > <bb 3> [local count: 805306369]: > _11 = pretmp_13 & 5; > goto <bb 5>; [100.00%] > > <bb 4> [local count: 536870913]: > if (pretmp_13 != 0) > goto <bb 3>; [50.00%] > else > goto <bb 5>; [50.00%] > > <bb 5> [local count: 1073741824]: > # prephitmp_12 = PHI <_11(3), 0(4)> So the bug is inside value_replacement where we move the definition of _11 to be inside bb 4: (gdb) p debug_bb(cond_bb) ;; basic block 4, loop depth 0, count 536870913 (estimated locally), maybe hot ;; prev block 3, next block 5, flags: (NEW, REACHABLE, VISITED) ;; pred: 2 [50.0% (guessed)] count:536870912 (estimated locally) (FALSE_VALUE,EXECUTABLE) _11 = pretmp_13 & 5; if (pretmp_13 != 0) goto <bb 3>; [50.00%] else goto <bb 5>; [50.00%] ;; succ: 3 [50.0% (guessed)] count:268435457 (estimated locally) (TRUE_VALUE,EXECUTABLE) ;; 5 [50.0% (guessed)] count:268435457 (estimated locally) (FALSE_VALUE,EXECUTABLE)