https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123560
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Component|rtl-optimization |middle-end
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I have not fully looked into why it was rejected but we do get:
```
IF-THEN-ELSE-JOIN block found, pass 1, test 2, then 3, else 4, join 5
IF-CASE-2 found, start 2, else 4
```
on ifcvt. So it looks like it was found but not turned.
Note you can get what you want with:
```
int bla(int last_digit, uint32_t len) {
int t = (last_digit != 0);
t*=17;
return t + (last_digit == 0) * (len - (len == 1));
}
```
Not fully because:
```
_4 = len_13(D) == 1;
_5 = (unsigned int) _4;
_6 = len_13(D) - _5;
```
into `(len == 1) ? 0 : len`.