https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104356
--- Comment #16 from Richard Biener <rguenth at gcc dot gnu.org> ---
Related simplifications:
/* X / bool_range_Y is X. */
(simplify
(div @0 SSA_NAME@1)
(if (INTEGRAL_TYPE_P (type) && ssa_name_has_boolean_range (@1))
@0))
/* X / abs (X) is X < 0 ? -1 : 1. */
(simplify
(div:C @0 (abs @0))
(if (INTEGRAL_TYPE_P (type)
&& TYPE_OVERFLOW_UNDEFINED (type))
(cond (lt @0 { build_zero_cst (type); })
{ build_minus_one_cst (type); } { build_one_cst (type); })))
/* X / -X is -1. */
(simplify
(div:C @0 (negate @0))
(if ((INTEGRAL_TYPE_P (type) || VECTOR_INTEGER_TYPE_P (type))
&& TYPE_OVERFLOW_UNDEFINED (type))
{ build_minus_one_cst (type); })))