https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115202
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- It's a missed PRE: ANTIC_OUT[3] := { iftmp.0_6 (0006), {min_expr,iftmp.0_6,-1} (0011), {nop_expr,pretmp_10} (0012) } [changed] ANTIC_IN[3] := { {mem_ref<0B>,addr_expr<&m>}@.MEM_5(D) (0001), {nop_expr,m.1_1} (0006), {min_expr,iftmp.0_6,-1} (0011), {nop_expr,pretmp_10} (0012) } <bb 3> [local count: 536870912]: m.1_1 = m; iftmp.0_6 = (int) m.1_1; <bb 4> [local count: 1073741824]: # iftmp.0_2 = PHI <iftmp.0_6(3), a_4(D)(5)> _7 = MIN_EXPR <iftmp.0_2, -1>; we fail to fully simplify MIN_EXPR <iftmp.0_6, -1> because we lack a pattern for MIN ((int)ushrtvar, -1) Adding a lame (simplify (min (convert @0) INTEGER_CST@1) (if (TYPE_UNSIGNED (TREE_TYPE (@0)) && TYPE_PRECISION (type) > TYPE_PRECISION (TREE_TYPE (@0)) && tree_int_cst_sgn (@1) == -1) @1)) makes us PRE the MIN to <bb 2> [local count: 1073741824]: if (f_3(D) != 0) goto <bb 4>; [50.00%] else goto <bb 3>; [50.00%] <bb 3> [local count: 536870912]: _10 = MIN_EXPR <a_4(D), -1>; _12 = (short unsigned int) _10; goto <bb 5>; [100.00%] <bb 4> [local count: 536870912]: <bb 5> [local count: 1073741824]: # prephitmp_13 = PHI <65535(4), _12(3)> return prephitmp_13; which produces _Z4funcii: .LFB1: .cfi_startproc testl %edi, %edi movl $-1, %eax cmovns %eax, %edi testl %esi, %esi movl $65535, %eax cmove %edi, %eax ret which looks even worse.