https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107772
--- Comment #5 from Avi Kivity <avi at scylladb dot com> --- It indeed generates better code. However, it requires that I duplicate the function body, which can be hard at times (consider f == std::transform and "if (*b != 0) { *b = g(*b); }" as a lambda input.