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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> Interesting clang is able to optimize the above but not the loop.

clang produces:
```
unsigned bar1(char* buf, unsigned len)
{
    unsigned t = len - (len != 0) + 1;
    t = t & ~1;
    len = len - t;
    if (len)
      * buf = 42;
    return len;
}
```

Which and what is missing is the transformation of `len - (len != 0) + 1` to
just `max<len, 1>` which I created PR 118317 for that and once that is done GCC
is able to handle the rest for that form too (due to the match patterns added
by PR 98304).

Reply via email to