https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126138
Bug ID: 126138
Summary: `fp0 == fp1 || fp0 CMP fp1` can be combined always
even with trapping
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: pinskia at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
int f (double i, double j)
{
return (i == j) || (i < j);
}
```
This can be optimized to `i <= j` as Nan will cause (i == j) to return false so
you will always get the trapping expression `i < j`.
I have a patch for fold. But it seems not working for ifcombine which I need to
figure out why still.
The same is true with:
```
int g(double i, double j)
{
return (i != j) && (i < j);
}
```