https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123120
Bug ID: 123120
Summary: phiprop does not always work
Product: gcc
Version: 16.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:
```
#include <algorithm>
long f0(short c, short d, long long a)
{
return std::max(std::min((long long)3, a), (long long)d);
}
long f1(short c, short d, long long a)
{
return std::max((long long)d, std::min((long long)3, a));
}
```
depending on the order of argument execution (x86_64 is different from
aarch64/riscv), only one of f0 or f1 gets optimized in phiopt1 to min/max.
I thought I saw a duplicate but I can't find it right now.