https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114340

            Bug ID: 114340
           Summary: ` X / CST < X` -> `X > 0`
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

int f(int x)
{
        return x / 100 < x;
}

Can be transformed into just:
int f(int x)
{
        return x > 0;
}
For signed types.

For unsigned types, it is `x != 0` (but that is also `x > 0` really).

Reply via email to