https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126134
Bug ID: 126134
Summary: `((x&5)!=5 ? x|5 : x` -> `x|5` and `((a&5)==5?x|5:x`
-> `x` are not done
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: easyhack, 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 a)
{
if ((a&5)!=5) return a | 5;
return a;
}
int f1(int a)
{
if ((a&5)==5) return a | 5;
return a;
}
```
f should simplify down to `return x|5`.
While f1 should simplify down to `return x`.
Note f1 is handled on the RTL level.
Note f1 could also be handled in VRP (will file a different bug for that).