On 6/14/2026 10:02 AM, Kael Andrew Franco wrote:
 From ae75421fd6c7d50e5b1e9aafea2ae3cbcd4ebc1c Mon Sep 17 00:00:00 2001
From: Kael Andrew Alonzo Franco <[email protected]>
Date: Sun, 14 Jun 2026 06:28:01 -0400
Subject: [PATCH] match: For nonnegative X and Y, relax condition on X % Y < Y 
to true [PR125737]

tree_expr_nonnegative_p covers TYPE_UNSIGNED (type) or when X and Y are known 
to be nonnegative.

Bootstrapped and tested on x86_64-pc-linux-gnu

        PR tree-optimization/125737

gcc/ChangeLog:

        PR tree-optimization/125737
        * match.pd: Use tree_expr_nonnegative_p for X % Y < Y to true.

gcc/testsuite/ChangeLog:

        PR tree-optimization/125737
        * gcc.dg/125737.c: New test.
Thanks.  I've pushed this to the trunk as well.  I'll note that you're checking both types as being non-negative now when previously we just checked the first was UNSIGNED.  So your test is both tighter in some ways and looser in others.  Regardless it looks good and I've pushed it to the trunk.
jeff

Reply via email to