https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115350

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-06-05
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
What is more interesting is the order of evulation of the function arguments
make a huge difference.
Testcase:
```
unsigned short n;
#include <algorithm>
void fn1( unsigned short f, unsigned char a) {
    auto t1 = -a;
    auto t = f ? 0 : 3;
    n = std::min(t, t1); // equals to "n = -a"
}
void fn2( unsigned short f, unsigned char a) {
    auto t = f ? 0 : 3;
    auto t1 = -a;
    n = std::min(t, t1); // equals to "n = -a"
}
```

fn2 works while f1 does not.

fn2 used to be only optimized at the rtl level too ..

Reply via email to