https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124460
Bug ID: 124460
Summary: `f = max<f, invariant>` not pulled out of a loop
Product: gcc
Version: 16.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: ---
Take:
```
int test(int f, int t) {
for (int o = 0; o < t; o ++)
f = (f < 0 ? f : 0);
return f;
}
```
This should be optimized to just:
```
if (t >= 0)
f = (f < 0 ? f : 0);
return f;
```