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

            Bug ID: 120280
           Summary: ABS<int> < 0 is not optimized to false by match
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: pinskia at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
            Blocks: 120206
  Target Milestone: ---

Take:
```
int g(int);
int f(int a)
{
  int b = __builtin_abs (a);
  return g(b < 0);
}
```


This should have been optimized in CCP1 to just `return g(0);` But it is not
until forwprop1 we are able to optimize it (using fold rather than match):
```
gimple_simplified to _2 = 0;
Removing dead stmt:_1 = 0;
Removing dead stmt:_2 = 0;
```


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120206
[Bug 120206] Removal of
forward_propagate_into_gimple_cond/forward_propagate_into_comparison

Reply via email to