https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127103
--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
t_3 = 2147483647 - a_1(D);
ttt_5 = MAX_EXPR <a_1(D), 1>;
ttt_6 = MIN_EXPR <t_3, ttt_5>;
tt_7 = a_1(D) + ttt_6;
to:
b_4 = a_2(D) * 2;
a_5 = MIN_EXPR <b_4, 2147483647>;
_8 = MAX_EXPR <a_5, 1>;
So
(simplify
(plus:c @0 (min:cs (minus:s INTEGER_CST@1 @0) (max:cs @0 integer_onep@2)))
(if (TYPE_UNSIGNED (type)
&& @1 == signedtypemax(type)
&& rangemaxof(@0) < signedtypemax(type))
(max (min (mult @0 { 2; } ) @1) @1))
Yes this is a really specialized match pattern but this shows up in real code
and is optimized away for LLVM too but not using this way. But this also
produces slightly better code in general.