https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94566
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- So for conv2 the most immediate issue is that we're failing to sink and common the assignment to D.8516._M_value (I had patches for this). conv2 (int i) { int i_2(D) = i; struct strong_ordering D.8516; <bb 2> [local count: 1073741824]: if (i_2(D) == 0) goto <bb 5>; [33.33%] else goto <bb 3>; [66.67%] <bb 3> [local count: 1073741824]: if (i_2(D) == 1) goto <bb 6>; [50.00%] else goto <bb 4>; [50.00%] <bb 4> [local count: 357878150]: D.8516._M_value = -1; goto <bb 7>; [100.00%] <bb 5> [local count: 357878150]: D.8516._M_value = 0; goto <bb 7>; [100.00%] <bb 6> [local count: 357878150]: D.8516._M_value = 1; <bb 7> [local count: 1073634451]: return D.8516; for conv1 this is a missed phi-opt, at phiopt2 time: conv1 (struct strong_ordering s) { int SR.4; int _1; <bb 2> [local count: 1073741824]: SR.4_4 = s._M_value; if (SR.4_4 == -1) goto <bb 6>; [50.00%] else goto <bb 3>; [50.00%] <bb 3> [local count: 536870913]: if (SR.4_4 == 0) goto <bb 6>; [50.00%] else goto <bb 4>; [50.00%] <bb 4> [local count: 268435456]: if (SR.4_4 == 1) goto <bb 6>; [100.00%] else goto <bb 5>; [0.00%] <bb 5> [count: 0]: __builtin_unreachable (); <bb 6> [local count: 1073741824]: # RANGE [-1, 1] # _1 = PHI <-1(2), 0(3), 1(4)> return _1; it's a bit of a convoluted case of course but the only chance to pattern match this ...