https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126087
Bug ID: 126087
Summary: `MIN<nonnegative,a> >= 0` is not simplified into `a >=
0`
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: missed-optimization, TREE
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
void use();
void f2(int a, unsigned short bb) {
int b = bb;
int m = a < b ? a : b;
if (m >= 0) use();
}
void f3(int a, unsigned short bb) {
int b = bb;
int m = a|b;
if (m >= 0) use();
}
```
Both of these should be optimized to just `if (a >= 0) use();`.
Currently f3 is optimized to that on the RTL level for some targets.
for < 0, the same is true.