https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126044
--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
if (rhs_code == TRUNC_MOD_EXPR
&& TREE_CODE (op1min) == INTEGER_CST
&& tree_int_cst_sgn (op1min) == 1
&& op0max
&& tree_int_cst_lt (op0max, op1min))
{
if (TYPE_UNSIGNED (TREE_TYPE (op0))
|| tree_int_cst_sgn (op0min) >= 0
|| tree_int_cst_lt (fold_unary (NEGATE_EXPR, TREE_TYPE (op1min),
op1min),
op0min))
{
/* If op0 already has the range op0 % op1 has,
then TRUNC_MOD_EXPR won't change anything. */
gimple_assign_set_rhs_from_tree (gsi, op0);
return true;
}
}