https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100263
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Though, looking at the r11-39 optimized dump, I actually don't see anything wrong. The path taken in the testcase should be: <bb 2> [local count: 1073741824]: b.0_1 = b; if (b.0_1 != 2) goto <bb 3>; [96.34%] ... <bb 3> [local count: 1034442872]: ... <bb 4> [local count: 10321168952]: # b.12_44 = PHI <b.0_1(3), _32(42)> # c__lsm.20_50 = PHI <c__lsm.20_75(D)(3), c__lsm.20_51(42)> # c__lsm_flag.21_52 = PHI <0(3), c__lsm_flag.21_53(42)> ... if (a.1_7 != 0) goto <bb 5>; [50.00%] else goto <bb 19>; [50.00%] ... <bb 5> [local count: 5160584476]: if (h.4_5 != 0) goto <bb 9>; [89.00%] else goto <bb 42>; [11.00%] ... <bb 42> [local count: 9639533214]: # c__lsm.20_51 = PHI <c__lsm.20_50(41), 1(5)> # c__lsm_flag.21_53 = PHI <c__lsm_flag.21_52(41), 1(5)> ... _32 = b.12_44 + 254; if (_32 != 2) goto <bb 4>; [96.34%] else goto <bb 43>; [3.66%] <bb 43> [local count: 352806927]: if (c__lsm_flag.21_53 != 0) goto <bb 44>; [66.67%] else goto <bb 45>; [33.33%] <bb 44> [local count: 235204617]: MEM[(char *)&c + 107B] = c__lsm.20_51; where bb will loop 126 times and then fall through to bb 43, but when bb 42 is reached from bb 5 (should be always), then both SSA_NAMEs 51 and 53 are 1 and so the store of 1 should happen.