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

            Bug ID: 117623
           Summary: abs(a) == INT_MIN -> A == INT_MIN
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

For wrapv and/or ABSU. you can optimize abs(a) == INT_MIN to just a == INT_MIN.
```
int f(int a)
{
  int c = -__INT_MAX__ - 1;
  a = __builtin_abs (a);
  return c == a;
}
```

I wonder if we want to optimize this always even without wrapv too ...

Reply via email to