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

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu.org

--- Comment #4 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
You'll get better results from outlining a rare path manually: the
prologue/epilogue won't be re-executed for each invocation of 'g':

int g(int);

__attribute__((noinline,cold))
static void f_slowpath(int* b, int* e)
{
    switch (0)
    do {
        if (*b != 0)
            default: *b = g(*b);
    } while (++b != e);
}

void f(int* b, int* e)
{
    for (; b != e; b++)
        if (*b != 0) {
            f_slowpath(b, e);
            return;
        }
}

Reply via email to