https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110068
Bug ID: 110068
Summary: missing min detection
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: 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: ---
Take:
```
#define min1(x,y) ((x) < (y) ? (x) : (y))
#define min2(x,y) ((x) <= (y) ? (x) : (y))
static inline unsigned
min3(unsigned x, unsigned y)
{
return min1(x, y);
}
static inline unsigned
min4(unsigned x, unsigned y)
{
return min3(x, y);
}
unsigned
f1 (unsigned x)
{
return min1(x, 1U<<(sizeof(x)*8-1));
}
unsigned
f2 (unsigned x)
{
return min2(x, 1U<<(sizeof(x)*8-1));
}
unsigned
f3 (unsigned x)
{
return min3(x, 1U<<(sizeof(x)*8-1));
}
unsigned
f4 (unsigned x)
{
return min4(x, 1U<<(sizeof(x)*8-1));
}
```
f1,f2,f3, and f4 should all produce MIN_EXPRs but currently f1 does not.
I would have thought r11-1504-g2e0f4a18bc978 fixed this case but it does not.